Anut-py / h-raylib

Haskell bindings for raylib
https://hackage.haskell.org/package/h-raylib
Apache License 2.0
84 stars 14 forks source link

Raylib official example gltf model glb file loading causing core dump #61

Open futu2 opened 2 weeks ago

futu2 commented 2 weeks ago

my code is here https://github.com/futu2/h-raylib-examples/blob/master/src/ModelsLoadingGltf.hs , and logs:

Examples available:
1. basic window
2. input keys
3. input mouse
4. input mouseWheel
5. input gesture
6. camera 2d
7. camera 2d mouse zoom
8. camera 2d platformer
9. camera 2d split screen
10. models loading gltf
Input number to select example:
10
INFO: Initializing raylib 5.5-dev
INFO: Platform backend: DESKTOP (GLFW)
INFO: Supported raylib modules:
INFO:     > rcore:..... loaded (mandatory)
INFO:     > rlgl:...... loaded (mandatory)
INFO:     > rshapes:... loaded (optional)
INFO:     > rtextures:. loaded (optional)
INFO:     > rtext:..... loaded (optional)
INFO:     > rmodels:... loaded (optional)
INFO:     > raudio:.... loaded (optional)
INFO: DISPLAY: Device initialized successfully
INFO:     > Display size: 2560 x 1440
INFO:     > Screen size:  800 x 450
INFO:     > Render size:  800 x 450
INFO:     > Viewport offsets: 0, 0
INFO: GLAD: OpenGL extensions loaded successfully
INFO: GL: Supported extensions count: 401
INFO: GL: OpenGL device information:
INFO:     > Vendor:   NVIDIA Corporation
INFO:     > Renderer: NVIDIA GeForce RTX 3060 Laptop GPU/PCIe/SSE2
INFO:     > Version:  3.3.0 NVIDIA 560.35.03
INFO:     > GLSL:     3.30 NVIDIA via Cg compiler
INFO: GL: VAO extension detected, VAO functions loaded successfully
INFO: GL: NPOT textures extension detected, full NPOT textures supported
INFO: GL: DXT compressed textures supported
INFO: GL: ETC2/EAC compressed textures supported
INFO: PLATFORM: DESKTOP (GLFW - X11): Initialized successfully
INFO: TEXTURE: [ID 1] Texture loaded successfully (1x1 | R8G8B8A8 | 1 mipmaps)
INFO: TEXTURE: [ID 1] Default texture loaded successfully
INFO: SHADER: [ID 1] Vertex shader compiled successfully
INFO: SHADER: [ID 2] Fragment shader compiled successfully
INFO: SHADER: [ID 3] Program shader loaded successfully
INFO: SHADER: [ID 3] Default shader loaded successfully
INFO: RLGL: Render batch vertex buffers loaded successfully in RAM (CPU)
INFO: RLGL: Render batch vertex buffers loaded successfully in VRAM (GPU)
INFO: RLGL: Default OpenGL state initialized successfully
INFO: TEXTURE: [ID 2] Texture loaded successfully (128x128 | GRAY_ALPHA | 1 mipmaps)
INFO: FONT: Default font loaded successfully (224 glyphs)
INFO: SYSTEM: Working Directory: /home/seikan/Documents/code/h-raylib-examples
INFO: TIMER: Target time per frame: 16.667 milliseconds
INFO: FILEIO: [resources/gltf/robot.glb] File loaded successfully
INFO: MODEL: [resources/gltf/robot.glb] Model basic data (glb) loaded successfully
INFO:     > Meshes count: 14
INFO:     > Materials count: 3 (+1 default)
INFO: VAO: [ID 2] Mesh uploaded successfully to VRAM (GPU)
INFO: VAO: [ID 3] Mesh uploaded successfully to VRAM (GPU)
INFO: VAO: [ID 4] Mesh uploaded successfully to VRAM (GPU)
INFO: VAO: [ID 5] Mesh uploaded successfully to VRAM (GPU)
INFO: VAO: [ID 6] Mesh uploaded successfully to VRAM (GPU)
INFO: VAO: [ID 7] Mesh uploaded successfully to VRAM (GPU)
INFO: VAO: [ID 8] Mesh uploaded successfully to VRAM (GPU)
INFO: VAO: [ID 9] Mesh uploaded successfully to VRAM (GPU)
INFO: VAO: [ID 10] Mesh uploaded successfully to VRAM (GPU)
INFO: VAO: [ID 11] Mesh uploaded successfully to VRAM (GPU)
INFO: VAO: [ID 12] Mesh uploaded successfully to VRAM (GPU)
INFO: VAO: [ID 13] Mesh uploaded successfully to VRAM (GPU)
INFO: VAO: [ID 14] Mesh uploaded successfully to VRAM (GPU)
INFO: VAO: [ID 15] Mesh uploaded successfully to VRAM (GPU)
INFO: VAO: [ID 16] Mesh uploaded successfully to VRAM (GPU)
INFO: VAO: [ID 17] Mesh uploaded successfully to VRAM (GPU)
INFO: VAO: [ID 18] Mesh uploaded successfully to VRAM (GPU)
INFO: VAO: [ID 19] Mesh uploaded successfully to VRAM (GPU)
INFO: VAO: [ID 20] Mesh uploaded successfully to VRAM (GPU)
[2]    3696779 segmentation fault (core dumped)  nix run   

official example is here Model files used are directly copied from raylib repo. https://github.com/raysan5/raylib/tree/master/examples/models

Meanwhile, after try some other glb model( like raylib_3d_logo), model loading works well. But for other glb models with animation, model&animation loading are both ok, but animation updated model are totally mess, while some of them having warnings like bone not bind to mesh.