Solar-Falcon / rust-raylib

zlib License
9 stars 2 forks source link

Add an option to change the opengl version. #2

Closed Blayung closed 4 months ago

Blayung commented 5 months ago

I'm on a very old laptop that supports opengl versions only up to 2.1.

From what I've read, I belive you can do it by simply adding #define GRAPHICS_API_OPENGL_21 to the c code, I have no idea how these bindings and stuff works though.

Solar-Falcon commented 5 months ago

I've added cargo features in 0.45.10 for choosing a specific GL version. This should work, but I'm unsure how to test it on my end, so comment if you still got any problems.

Blayung commented 5 months ago

Nope:

INFO: Initializing raylib 4.5
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)
WARNING: GLFW: Error: 65543 Description: GLX: Failed to create context: GLXBadFBConfig
WARNING: GLFW: Failed to initialize Window
FATAL: Failed to initialize Graphic Device

Setting LIBGL_ALWAYS_SOFTWARE=1 fixes it, so it clearly is an issue with the opengl version.

Solar-Falcon commented 4 months ago

Committed another attempt at fixing. I've resorted to directly setting GRAPHICS_APIOPENGL*** via c compiler flags. Previously I tried setting cmake options for this (OPENGL_VERSION) but either I'm an idiot or it doesn't seem to work. I don't really know a lot about cmake.

I'll upload a new version on crates once I'm sure it actually works (I've tried to test it a bit and it seems to work, but I'm still not sure), you can pull from github directly for now I guess.

Blayung commented 4 months ago

Yes, it works now! Thank you :D