[fpc-pascal] glGetString crash

Jonas Maebe jonas at freepascal.org
Mon Feb 19 22:24:58 CET 2018


On 19/02/18 03:21, Ryan Joseph wrote:
> Maybe SDL has a bug then because glGetString should never crash.

glGetString is not an SDL function, but an OpenGL framework version.

> When are the land Load_GL_VERSION_XXX functions meant to be called in the pipeline? I was calling them before the openGL context is created (which works except for 3.x on the old MacBook) but I just tried calling Load_GL_VERSION_3_0 after the context was created and I got some random errors from OpenGL functions (Load_GL_VERSION_2_1 in a legacy context did work however).

It's invalid to call glGetString before a context has been created, 
since it returns information about the context: 
https://www.khronos.org/opengl/wiki/OpenGL_Context#Context_information_queries 
(or 
https://stackoverflow.com/questions/6288759/why-could-glgetstringgl-version-be-causing-a-seg-fault 
)

My guess is that the Load_GL_VERSION_3_3x() function is broken since it 
appears to call glGetString before a context has been created, and that 
it just happens to work on some (most?) implementations by pure chance.


Jonas



More information about the fpc-pascal mailing list