PDA

View Full Version : glCheckFramebufferStatus example?



hauberg
02-05-2011, 10:52 AM
Hi All

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.

Thanks
Søren

randall
02-05-2011, 12:03 PM
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.

_arts_
02-05-2011, 12:22 PM
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.

Alfonse Reinheart
02-05-2011, 01:29 PM
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.

hauberg
02-05-2011, 01:51 PM
Wonderful! I just took the easy way out by defining GL_GLEXT_PROTOTYPES as I just needed this for some quick checks.

Thanks a bunch
Søren

hauberg
02-05-2011, 01:52 PM
Indeed you are correct! This did not appear to be the problem. Might I be so bold to ask if you have any thoughts on what the problem might be?

Thanks
Søren

_arts_
02-05-2011, 02:39 PM
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.