GithubHelp home page GithubHelp logo

chunqian / go-raylib Goto Github PK

View Code? Open in Web Editor NEW
44.0 44.0 3.0 39.57 MB

go-raylib is a simple and easy-to-use library to enjoy videogames programming

License: zlib License

Makefile 3.28% C 91.56% CMake 0.77% Shell 0.35% C++ 0.56% GLSL 2.74% Batchfile 0.23% Roff 0.02% Meson 0.03% HTML 0.26% Go 0.19%

go-raylib's People

Contributors

chunqian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

go-raylib's Issues

SIGSEGV LoadTextureFromImage

Hi, using LoadTextureFromImage I got segmentation fault each time. Pretty short to reproduce:

package main

import (
    rl "github.com/chunqian/go-raylib/raylib"
    "runtime"
)

func init() {
    runtime.LockOSThread()
}

func main() {
    tileset := rl.LoadImage("./tileset.png")
    _ = rl.LoadTextureFromImage(tileset)
}

Results in:

INFO: FILEIO: [./tileset.png] File loaded successfully
INFO: IMAGE: [./tileset.png] Data loaded successfully (32x32)
fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x7fff3b703e6b]

runtime stack:
runtime.throw(0x41e1009, 0x2a)
	/usr/local/Cellar/go/1.13.4/libexec/src/runtime/panic.go:774 +0x72
runtime.sigpanic()
	/usr/local/Cellar/go/1.13.4/libexec/src/runtime/signal_unix.go:378 +0x47c

goroutine 1 [syscall, locked to thread]:
runtime.cgocall(0x40b95c0, 0xc000047de8, 0xc00000e400)
	/usr/local/Cellar/go/1.13.4/libexec/src/runtime/cgocall.go:128 +0x5b fp=0xc000047d98 sp=0xc000047d60 pc=0x40086cb
github.com/chunqian/go-raylib/raylib._Cfunc_LoadTextureFromImage(0x4809800, 0x2000000020, 0x400000001, 0x0, 0x0, 0x0)
	_cgo_gotypes.go:6208 +0x56 fp=0xc000047de8 sp=0xc000047d98 pc=0x408b0c6
github.com/chunqian/go-raylib/raylib.LoadTextureFromImage.func1(0x4809800, 0x2000000020, 0x400000001, 0x0, 0x0, 0x0)
	/Users/hfabre/go/src/github.com/chunqian/go-raylib/raylib/raylib.go:2085 +0xbb fp=0xc000047e58 sp=0xc000047de8 pc=0x408c1fb
github.com/chunqian/go-raylib/raylib.LoadTextureFromImage(0x4809800, 0x2000000020, 0x400000001, 0x0, 0x0, 0x0)
	/Users/hfabre/go/src/github.com/chunqian/go-raylib/raylib/raylib.go:2085 +0x92 fp=0xc000047f08 sp=0xc000047e58 pc=0x408c002
main.main()
	/Users/hfabre/local/perso/go/test/main.go:14 +0x62 fp=0xc000047f60 sp=0xc000047f08 pc=0x408cbc2
runtime.main()
	/usr/local/Cellar/go/1.13.4/libexec/src/runtime/proc.go:203 +0x21e fp=0xc000047fe0 sp=0xc000047f60 pc=0x4030fae
runtime.goexit()
	/usr/local/Cellar/go/1.13.4/libexec/src/runtime/asm_amd64.s:1357 +0x1 fp=0xc000047fe8 sp=0xc000047fe0 pc=0x4059551
exit status 2

Here is the image in case you need it:
tileset

Latest commit won't compile on Linux

When trying to compile basic_window.go on Linux, using the latest commit 6ee277f, I get this error output:

/usr/bin/ld: ../../../../pkg/mod/github.com/chunqian/[email protected]/raylib/../lib/raylib/plat/linux/libraylib.a(text.c.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../../../pkg/mod/github.com/chunqian/[email protected]/raylib/../lib/raylib/plat/linux/libraylib.a(raudio.c.o): relocation R_X86_64_32S against `.text' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../../../pkg/mod/github.com/chunqian/[email protected]/raylib/../lib/raylib/plat/linux/libraylib.a(core.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../../../pkg/mod/github.com/chunqian/[email protected]/raylib/../lib/raylib/plat/linux/libraylib.a(models.c.o): relocation R_X86_64_32 against `.text' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../../../pkg/mod/github.com/chunqian/[email protected]/raylib/../lib/raylib/plat/linux/libraylib.a(utils.c.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../../../pkg/mod/github.com/chunqian/[email protected]/raylib/../lib/raylib/plat/linux/libraylib.a(textures.c.o): relocation R_X86_64_32 against `.data' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../../../pkg/mod/github.com/chunqian/[email protected]/raylib/../lib/raylib/plat/linux/libraylib.a(shapes.c.o): warning: relocation against `sincosf@@GLIBC_2.2.5' in read-only section `.text'
collect2: error: ld returned 1 exit status

No binary is built.

This is the default gcc flags Go is using. I never set this myself.

โžค go env GOGCCFLAGS
-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build988534947=/tmp/go-build -gno-record-gcc-switches

I had trouble changing it to use -fPIE instead and gave up.

The latest commit that successfully compiles on Linux is 90039da , before any .a files have been added. There were some warnings, but a binary was made and it worked fine.

My suggestion: Just remove the .a files. What is the point of having them? I'd rather just build the library myself.

Why update raylib?

Why did you update the raylib library in c620d8c? Shouldn't this code stick to the 3.5 release? 3.6-dev will update frequently and have bugs, it's not ready yet.

Trouble installing package

So I'm trying to import it but with no success:

image

the go.mod:
image

if I run go mod tidy:

go: finding module for package github.com/chunqian/go-raylib
github.com/jeedee/kobu-server imports
        github.com/chunqian/go-raylib: module github.com/chunqian/go-raylib@latest found (v0.0.0-20210519095144-df36dae46c76), but does not contain package github.com/chunqian/go-raylib

Different result in go and C function: LoadFontEx

Hi I'm struggling with text output and almost gave up.

And As I see main problem is function : LoadFontEx

It works in C, I took an example about text and have such string :
Font fontTtf = LoadFontEx("Ubuntu-Regular.ttf", 256, 0, 2048);
in the log output:


INFO: FILEIO: [Ubuntu-Regular.ttf] File loaded successfully
INFO: TEXTURE: [ID 3] Texture created successfully (16384x16384 - 1 mipmaps)

in Go I have such string:
font := rl.LoadFontEx("Ubuntu-Regular.ttf", 256, &s, 2048)
and in the logs :

INFO: FILEIO: [Ubuntu-Regular.ttf] File loaded successfully
INFO: TEXTURE: [ID 3] Texture created successfully (512x512 - 1 mipmaps)

and of course there is no any output in the window of go version.
And all works perfect with C version.

I'm writing here because I see project looks alive and maybe some one has solution.

OS:
MacOS 11
arm64

Go:
1.16.3

go-raylib:
v0.0.0-20210424023010-5a21bdadf8d6

possible memory leaks?

Hey, this is my first issue on Github, so bear with me...
I've been playing around with Raylib using pure interop with Swift language. As a comparison, I wanted to check for memory leaks against Go (which is a language I'm familiar with), and I found something interesting.

No matter what code it would be, you could use an example provided, and you would get similar or the same memory loss/leak.
I will go straight to the point.

Memory Check with Valgrind
If you check out the gist linked above, you can see that around 40,015 bytes in 573 blocks are possibly lost in go-raylib binding vs 0 bytes in 0 blocks against Swift's pure interop to C without any safe pointer management etc.

I did post this on raylib discord server under Go's channel, but I take it you aren't on the server? So I didn't know if it was worth posting it here either or not and find out what exactly is going on. Is it the binding that is leaking memory or something else?

Thanks!

Custom raylib build

Is there a way to use custom build of raylib. Or much better surround definitions in config.h file with ifndef flags and we can define custom options from CGO_CFLAGS

Running `go build` throws error

image

Note: I'm using go mod vendor which brings files to workspace folder:

image

edit: I was messing with the local files, seems to be a problem with cgo package?

image

Also according to the error message on the build process the file rglfw.c wasnt found, but I could find it here, just dont know how go does to find it:

image

IMPORTANT: This also happens on Linux (even after installing those packages: apt-get install libgl1-mesa-dev libxi-dev libxcursor-dev libxrandr-dev libxinerama-dev )

Visual glitch until moving window MacOS

Hi not sure if this come from Raylib itself or the bindings, but I got a weird glitch on my Mac. I just want to draw a rectangle, and it is drawn very small until I move the window, see the video:

raylib-weird.mp4

The code itself is really simple:

package main

import (
	rl "github.com/chunqian/go-raylib/raylib"
	"runtime"
)

const screenWidth = 1280
const screenHeight = 720

type Game struct {
	player *Player
}

func NewGame() Game {
	player := Player{
		pos:      rl.Vector2{20, 20},
		velocity: rl.Vector2{0, 0},
		size:     rl.Vector2{32, 64},
	}
	g := Game{player: &player}

	return g
}

type Player struct {
	pos, velocity, size rl.Vector2
}

func (g Game) Run() {
	rl.InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window")
	defer rl.CloseWindow()

	rl.SetTargetFPS(60)

	for !rl.WindowShouldClose() {
		g.Update()
		g.Draw()
	}
}

func (g Game) Update() {

}

func (g Game) Draw() {
	rl.BeginDrawing()
	defer rl.EndDrawing()

	rl.ClearBackground(rl.RayWhite)
	rl.DrawRectangleV(g.player.pos, g.player.size, rl.Green)
}

func init() {
	runtime.LockOSThread()
}

func main() {
	g := NewGame()
	g.Run()
}

Anyway, thanks for your work on this binding !

Can't go get go-raylib

Hello,

I think you did a mistake in your go.mod, i can't get go-raylib

go get github.com/chunqian/go-raylib
go: downloading github.com/chunqian/go-raylib v0.0.0-20210114120212-428a22a78ede
go: github.com/chunqian/go-raylib upgrade => v0.0.0-20210114120212-428a22a78ede
go get: github.com/chunqian/[email protected]: parsing go.mod:
        module declares its path as: goray
                but was required as: github.com/chunqian/go-raylib

Update to raylib 3.7

raylib 3.7 was just released. No rush on the update, just wanted to make this issue just in case.

Thanks for all your work maintaining this library! ๐Ÿ˜„

macOS warning - Implicit conversion of int to float

Hi,

Recently found this warning popping up regarding implicit conversion of int to float from within go-raylib:

github.com/chunqian/go-raylib/raylib In file included from ../../../../../pkg/mod/github.com/chunqian/[email protected]/raylib/raylib_darwin.go:11: In file included from ../../../../../pkg/mod/github.com/chunqian/[email protected]/raylib/../lib/raylib/src/models.c:89: ../../../../../pkg/mod/github.com/chunqian/[email protected]/raylib/../lib/raylib/src/external/par_shapes.h:1055:32: warning: implicit conversion from 'int' to 'float' changes value from 2147483647 to 2147483648 [-Wimplicit-const-int-float-conversion] /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdlib.h:105:18: note: expanded from macro 'RAND_MAX'

Error running gui examples on Windows 10

OS: Windows 10

Im try to test gui examples, but throws

C:/Users/usour/go/pkg/mod/github.com/chunqian/[email protected]/lib/raygui/src/raygui.h:3196: multiple definition of `GuiCheckIconPixel'
C:\Users\usour\AppData\Local\Temp\go-build1291992362\b038_x002.o:C:/Users/usour/go/pkg/mod/github.com/chunqian/[email protected]/lib/raygui/src/raygui.h:3196: first defined here

I recompiled raylib including physac and raygui , but throws the same error.

What could be ?

PBR example doesn't work on Linux [upstream]

Most examples are working great on Linux, I'm happy to see it! cubicmap and first_person_maze, for example. But the PBR one is not.

Here is a screenshot:

image

Some details come through but the overall color is not there.

Here is the log:

INFO: Initializing raylib 3.5
INFO: DISPLAY: Device initialized successfully
INFO:     > Display size: 1920 x 1080
INFO:     > Render size:  800 x 450
INFO:     > Screen size:  800 x 450
INFO:     > Viewport offsets: 0, 0
INFO: GLAD: OpenGL extensions loaded successfully
INFO: GL: OpenGL 3.3 Core profile supported
INFO: GL: OpenGL device information:
INFO:     > Vendor:   Intel
INFO:     > Renderer: Mesa Intel(R) UHD Graphics 620 (KBL GT2)
INFO:     > Version:  4.6 (Core Profile) Mesa 20.3.4
INFO:     > GLSL:     4.60
INFO: GL: Supported extensions count: 223
INFO: GL: DXT compressed textures supported
INFO: GL: ETC2/EAC compressed textures supported
INFO: GL: Anisotropic textures filtering supported (max: 16X)
INFO: TEXTURE: [ID 1] Texture created successfully (1x1 - 1 mipmaps)
INFO: TEXTURE: [ID 1] Default texture loaded successfully
INFO: SHADER: [ID 1] Compiled successfully
INFO: SHADER: [ID 2] Compiled successfully
INFO: SHADER: [ID 3] Program loaded successfully
INFO: SHADER: [ID 3] Default shader loaded successfully
INFO: RLGL: Internal vertex buffers initialized successfully in RAM (CPU)
INFO: RLGL: Render batch vertex buffers loaded successfully
INFO: RLGL: Default state initialized successfully
INFO: TEXTURE: [ID 2] Texture created successfully (128x128 - 1 mipmaps)
INFO: FONT: Default font loaded successfully
INFO: FILEIO: [../models/resources/pbr/trooper.obj] Text file loaded successfully
INFO: MODEL: [../models/resources/pbr/trooper.obj] OBJ data loaded successfully: 1 meshes / 0 materials
INFO: MODEL: No materials, putting all meshes in a default material
INFO: VAO: [ID 2] Mesh uploaded successfully to VRAM (GPU)
WARNING: MATERIAL: [../models/resources/pbr/trooper.obj] Failed to load material data, default to white material
INFO: MESH: Tangents data computed for provided mesh
INFO: FILEIO: [../models/resources/shaders/glsl330/pbr.vs] Text file loaded successfully
INFO: FILEIO: [../models/resources/shaders/glsl330/pbr.fs] Text file loaded successfully
INFO: SHADER: [ID 4] Compiled successfully
INFO: SHADER: [ID 5] Compiled successfully
INFO: SHADER: [ID 6] Program loaded successfully
INFO: SHADER: [ID 6] Shader uniform (albedo.sampler) set at location: 4
INFO: SHADER: [ID 6] Shader uniform (metalness.sampler) set at location: 10
INFO: SHADER: [ID 6] Shader uniform (normals.sampler) set at location: 7
INFO: SHADER: [ID 6] Shader uniform (roughness.sampler) set at location: 13
INFO: SHADER: [ID 6] Shader uniform (occlusion.sampler) set at location: 16
INFO: SHADER: [ID 6] Shader uniform (irradianceMap) set at location: 23
INFO: SHADER: [ID 6] Shader uniform (prefilterMap) set at location: 24
INFO: SHADER: [ID 6] Shader uniform (brdfLUT) set at location: 25
INFO: SHADER: [ID 6] Shader uniform (matModel) set at location: 1
INFO: SHADER: [ID 6] Shader uniform (viewPos) set at location: 47
INFO: FILEIO: [../models/resources/pbr/trooper_albedo.png] File loaded successfully
INFO: IMAGE: [../models/resources/pbr/trooper_albedo.png] Data loaded successfully (1024x1024)
INFO: TEXTURE: [ID 3] Texture created successfully (1024x1024 - 1 mipmaps)
INFO: FILEIO: [../models/resources/pbr/trooper_normals.png] File loaded successfully
INFO: IMAGE: [../models/resources/pbr/trooper_normals.png] Data loaded successfully (1024x1024)
INFO: TEXTURE: [ID 4] Texture created successfully (1024x1024 - 1 mipmaps)
INFO: FILEIO: [../models/resources/pbr/trooper_metalness.png] File loaded successfully
INFO: IMAGE: [../models/resources/pbr/trooper_metalness.png] Data loaded successfully (2048x2048)
INFO: TEXTURE: [ID 5] Texture created successfully (2048x2048 - 1 mipmaps)
INFO: FILEIO: [../models/resources/pbr/trooper_roughness.png] File loaded successfully
INFO: IMAGE: [../models/resources/pbr/trooper_roughness.png] Data loaded successfully (1024x1024)
INFO: TEXTURE: [ID 6] Texture created successfully (1024x1024 - 1 mipmaps)
INFO: FILEIO: [../models/resources/pbr/trooper_ao.png] File loaded successfully
INFO: IMAGE: [../models/resources/pbr/trooper_ao.png] Data loaded successfully (1024x1024)
INFO: TEXTURE: [ID 7] Texture created successfully (1024x1024 - 1 mipmaps)
INFO: FILEIO: [../models/resources/shaders/glsl330/cubemap.vs] Text file loaded successfully
INFO: FILEIO: [../models/resources/shaders/glsl330/cubemap.fs] Text file loaded successfully
INFO: SHADER: [ID 7] Compiled successfully
INFO: SHADER: [ID 8] Compiled successfully
INFO: SHADER: [ID 9] Program loaded successfully
INFO: FILEIO: [../models/resources/shaders/glsl330/skybox.vs] Text file loaded successfully
INFO: FILEIO: [../models/resources/shaders/glsl330/irradiance.fs] Text file loaded successfully
INFO: SHADER: [ID 10] Compiled successfully
INFO: SHADER: [ID 11] Compiled successfully
INFO: SHADER: [ID 12] Program loaded successfully
INFO: FILEIO: [../models/resources/shaders/glsl330/skybox.vs] Text file loaded successfully
INFO: FILEIO: [../models/resources/shaders/glsl330/prefilter.fs] Text file loaded successfully
INFO: SHADER: [ID 13] Compiled successfully
INFO: SHADER: [ID 14] Compiled successfully
INFO: SHADER: [ID 15] Program loaded successfully
INFO: FILEIO: [../models/resources/shaders/glsl330/brdf.vs] Text file loaded successfully
INFO: FILEIO: [../models/resources/shaders/glsl330/brdf.fs] Text file loaded successfully
INFO: SHADER: [ID 16] Compiled successfully
INFO: SHADER: [ID 17] Compiled successfully
INFO: SHADER: [ID 18] Program loaded successfully
INFO: SHADER: [ID 9] Shader uniform (equirectangularMap) set at location: 2
INFO: SHADER: [ID 12] Shader uniform (environmentMap) set at location: 2
INFO: SHADER: [ID 15] Shader uniform (environmentMap) set at location: 2
INFO: FILEIO: [../models/resources/dresden_square.hdr] File loaded successfully
INFO: IMAGE: [../models/resources/dresden_square.hdr] Data loaded successfully (1024x512)
INFO: TEXTURE: [ID 8] Texture created successfully (1024x512 - 1 mipmaps)
INFO: TEXTURE: [ID 1] Depth renderbuffer loaded successfully (16 bits)
INFO: TEXTURE: [ID 9] Cubemap texture created successfully (512x512)
INFO: FBO: [ID 1] Framebuffer object created successfully
INFO: FBO: [ID 1] Unloaded framebuffer from VRAM (GPU)
INFO: TEXTURE: [ID 2] Depth renderbuffer loaded successfully (16 bits)
INFO: TEXTURE: [ID 10] Cubemap texture created successfully (32x32)
INFO: FBO: [ID 2] Unloaded framebuffer from VRAM (GPU)
INFO: TEXTURE: [ID 3] Depth renderbuffer loaded successfully (16 bits)
INFO: TEXTURE: [ID 11] Cubemap texture created successfully (256x256)
INFO: SHADER: [ID 15] Shader uniform (roughness) set at location: 3
INFO: FBO: [ID 3] Unloaded framebuffer from VRAM (GPU)
INFO: TEXTURE: [ID 4] Depth renderbuffer loaded successfully (16 bits)
INFO: TEXTURE: [ID 12] Texture created successfully (512x512 - 1 mipmaps)
INFO: FBO: [ID 4] Unloaded framebuffer from VRAM (GPU)
INFO: TEXTURE: [ID 9] Unloaded texture data from VRAM (GPU)
INFO: TEXTURE: [ID 8] Unloaded texture data from VRAM (GPU)
INFO: SHADER: [ID 9] Unloaded shader program data from VRAM (GPU)
INFO: SHADER: [ID 12] Unloaded shader program data from VRAM (GPU)
INFO: SHADER: [ID 15] Unloaded shader program data from VRAM (GPU)
INFO: SHADER: [ID 18] Unloaded shader program data from VRAM (GPU)
INFO: SHADER: [ID 6] Shader uniform (albedo.useSampler) set at location: 3
INFO: SHADER: [ID 6] Shader uniform (normals.useSampler) set at location: 6
INFO: SHADER: [ID 6] Shader uniform (metalness.useSampler) set at location: 9
INFO: SHADER: [ID 6] Shader uniform (roughness.useSampler) set at location: 12
INFO: SHADER: [ID 6] Shader uniform (occlusion.useSampler) set at location: 15
INFO: SHADER: [ID 6] Shader uniform (renderMode) set at location: 46
INFO: SHADER: [ID 6] Shader uniform (lights[0].enabled) set at location: 26
INFO: SHADER: [ID 6] Shader uniform (lights[0].type) set at location: 27
INFO: SHADER: [ID 6] Shader uniform (lights[0].position) set at location: 28
INFO: SHADER: [ID 6] Shader uniform (lights[0].target) set at location: 29
INFO: SHADER: [ID 6] Shader uniform (lights[0].color) set at location: 30
INFO: SHADER: [ID 6] Shader uniform (lights[1].enabled) set at location: 31
INFO: SHADER: [ID 6] Shader uniform (lights[1].type) set at location: 32
INFO: SHADER: [ID 6] Shader uniform (lights[1].position) set at location: 33
INFO: SHADER: [ID 6] Shader uniform (lights[1].target) set at location: 34
INFO: SHADER: [ID 6] Shader uniform (lights[1].color) set at location: 35
INFO: SHADER: [ID 6] Shader uniform (lights[2].enabled) set at location: 36
INFO: SHADER: [ID 6] Shader uniform (lights[2].type) set at location: 37
INFO: SHADER: [ID 6] Shader uniform (lights[2].position) set at location: 38
INFO: SHADER: [ID 6] Shader uniform (lights[2].target) set at location: 39
INFO: SHADER: [ID 6] Shader uniform (lights[2].color) set at location: 40
INFO: SHADER: [ID 6] Shader uniform (lights[3].enabled) set at location: 41
INFO: SHADER: [ID 6] Shader uniform (lights[3].type) set at location: 42
INFO: SHADER: [ID 6] Shader uniform (lights[3].position) set at location: 43
INFO: SHADER: [ID 6] Shader uniform (lights[3].target) set at location: 44
INFO: SHADER: [ID 6] Shader uniform (lights[3].color) set at location: 45
INFO: TIMER: Target time per frame: 16.667 milliseconds
INFO: TEXTURE: [ID 3] Unloaded texture data from VRAM (GPU)
INFO: TEXTURE: [ID 4] Unloaded texture data from VRAM (GPU)
INFO: TEXTURE: [ID 5] Unloaded texture data from VRAM (GPU)
INFO: TEXTURE: [ID 6] Unloaded texture data from VRAM (GPU)
INFO: TEXTURE: [ID 7] Unloaded texture data from VRAM (GPU)
INFO: TEXTURE: [ID 10] Unloaded texture data from VRAM (GPU)
INFO: TEXTURE: [ID 11] Unloaded texture data from VRAM (GPU)
INFO: TEXTURE: [ID 12] Unloaded texture data from VRAM (GPU)
INFO: SHADER: [ID 6] Unloaded shader program data from VRAM (GPU)
INFO: VAO: [ID 2] Unloaded vertex data from VRAM (GPU)
INFO: MODEL: Unloaded model (and meshes) from RAM and VRAM
INFO: TEXTURE: [ID 2] Unloaded texture data from VRAM (GPU)
INFO: TEXTURE: [ID 1] Unloaded default texture data from VRAM (GPU)
INFO: Window closed successfully

Key line is:

WARNING: MATERIAL: [../models/resources/pbr/trooper.obj] Failed to load material data, default to white material

All other files are loaded successfully, I'm not sure why this one failed.

Build command is from the README.

How do I use this as a dependency?

With raylib-go I can just import the package into my project and Go will automatically compile raylib as needed. The README for this library shows manual compilation, and only demonstrates using the library for single-file examples in the same project. How can I import this and use it in a separate project?

Thank you!

Convert `const unsigned char` to `[]byte`, not `string`

Looking at the raylib cheatsheet, you can see that in many places const char is used for strings, while const unsigned char is used for bytes. But this package converts both of those to Go's string type. This is a problem, because if I load some bytes from a file or memory (maybe to load an image), I need to convert those bytes first with string(bytes). This copies all of the bytes before giving them to the library, because strings are immutable. Copying the bytes is an expensive and useless operation here.

There are ways around the copying, but could you just change the binding, so it converts const unsigned char to []byte? Thanks!

Example function that does this:

Image LoadImageFromMemory(const char *fileType, const unsigned char *fileData, int dataSize);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.