Applied patch to not crash on 3.2+ core profiles
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=727175
Most SOIL functions crash if OpenGL context is 3.2+ core profile. SOIL calls glGetString with a value that is no longer valid, and then sends the returned null pointer to strstr.
This patch checks the OpenGL version at runtime, and uses a glGetString function that is appropriate and available. It doesn't crash if, for whatever reason, glGetString returns a null pointer.
Hey thanks! I'm curious, but why are the files are severely different? It seems like you've changed a heck of a lot more then just glGetString
Uhm, that's a good question. All I added were the changes from the patch you can find in the bugreport I've linked above, along with a comment that it was patched and where I did get the patch from. Somehow the diff thinks I've changed everything? Might be due to line-endings (I'm on linux), don't know - it's my first pull request ever. :)
Yep, line-endings. I've changed them back to windows-style. By doing that I've accidentially commited a codeblocks file, which I've then deleted. Here's a patch with the changes only, in case you cannot use the pull request: fix_glGetString_crash.txt
Thinking about the changes, it likely won't work on windows and maybe mac due to the usage of glXGetProcAddressARB. Maybe the SOIL_internal_has_OGL_capability function could be improved by using parts of njcrawford's code. Can't test that for windows and mac unfortunately.
I can test it on mac and windows if it's in a state you think it'd work, but unfortunately I'm not familiar with OpenGL 3.2+