First post here, so please let me know if I picked the wrong place to post.
I’m trying to debug some GL code that crashes on ‘glRasterPos3d’. After Google’ing for some time I seem to get the impression that I should check if my framebuffer is properly initialised by calling
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
However, I can’t seem to figure out how to compile programs with the above line in them; I constantly get
error: ‘glCheckFramebufferStatus’ was not declared in this scope
I guess I need to include a specific header or something like that, but I’ve been tearing out my hair figuring out which one and how to include it (is there a specific order that headers must be included in?).
Does anybody have some pointers that could help me? Possible a simple program that shows how to call this function.
glCheckFramebufferStatus is a standard OpenGL function which was added to the core in OpenGL 3.0. You must get pointer to this function with GetProcAddres function or use library like GLEW.
If you stay under linux you can define GL_GLEXT_PROTOTYPES before including to gl.h and glext.h. This will avoid you to get function pointers or use glew.
error: ‘glCheckFramebufferStatus’ was not declared in this scope
If you’re getting this compile error, it also means that you’re not using a framebuffer object (that is, you didn’t make any other calls in ARB_FBO). Which means that, even if you got the function to work, it wouldn’t fix your problem.
glCheckFramebufferStatus is for testing the status of framebuffer objects. The default framebuffer either exists or doesn’t exist. And if it doesn’t exist, you know it doesn’t exist because you will have specified this as part of context creation.
So your raster pos problem has nothing to do with the framebuffer status.
I think what you wanted to do is something like this:
GLenum err = glGetError();
to check your error.
You can use gluErrorString to name your error id.
Between, crashing on glRasterPos3d should not happend. So whether you did mistakes with your pointers somewhere in your code, whether you have a problem with your GL lib, which should not happend.