gen2brain / raylib-go

Go bindings for raylib, a simple and easy-to-use library to enjoy videogames programming.
zlib License
1.54k stars 158 forks source link

Crash after LoadModel / Texture #399

Closed ewolution69 closed 1 month ago

ewolution69 commented 1 month ago

Hello, I am currently porting my “Odin language” code to Golang for performance tests. ( it loads the Sponza scene with lights and fog )

After loading the first texture the program crashes.

Output:

INFO: FILEIO: [Sponza/sponza.glb] File loaded successfully INFO: MODEL: [Sponza/sponza.glb] Model basic data (glb) loaded successfully INFO: > Meshes count: 1 INFO: > Materials count: 26 (+1 default) INFO: FILEIO: [./Sponza/9902244931375451333.png] File loaded successfully INFO: IMAGE: Data loaded successfully (1024x1024 | R8G8B8A8 | 1 mipmaps) SIGSEGV: segmentation violation PC=0x0 m=0 sigcode=1 addr=0x0 signal arrived during cgo execution

JupiterRider commented 1 month ago

Hey ewolution69, could you provide a tiny example project, which produces that error? Thanks in advance!

ewolution69 commented 1 month ago

Hello, I have uploaded a very small project which triggers the error.

Build system is LMDE 6 Faye ( Mint Debian Edition ) Go version: 1.22.4

https://github.com/ewolution69/Learning

JupiterRider commented 1 month ago

The function rl.InitWindow has to be called before rl.LoadModel. The reason for that is, that InitWindow initializes all the OpenGL stuff and without that, the Model cannot be loaded into your VRAM.

gen2brain commented 1 month ago

Thanks @JupiterRider , I guess this can be closed than?

ewolution69 commented 1 month ago

Thank you very much, that was my mistake .... I didn't pay attention to it the whole time.

@gen2brain Yes you can close it.