The thing is that I’ve used FBO several times with the same code that now is crashing. This happens since I add the OpenCL libs.
The strangest thing is that I remove all dependencies of OpenCL (that is, the code and compiler options are the same as when it worked) and still crashes!!
I thing there is a problem of versions but I don’t know how to check it.
Set a breakpoint at your call to glGenFramebuffersEXT, run it in the debugger and check the address of your glGenFramebuffersEXT function pointer. Many segfaults in OpenGL are a result of a NULL function pointer.
If glGenFramebuffersEXT isn’t declared in the same file as it’s used, and you’re using C, make sure that it’s "extern"ed properly too otherwise C’s “default int” will trip you up (I got caught by that one recently).
You should also initialize your “fbo” variable to 0 before calling glGenFramebuffersEXT. Aside from it being good practice, an uninitialized local variable may be given an arbitrary value (depending on your compiler and whether you’re doing a debug or a release build) which will result in undefined behaviour if glGenFramebuffersEXT attempts to do anything with it’s value before assigning it a new value.
Maybe your implementation does not support the old EXT version, but only the new ARB version.
Did you check for extension support ?
if (glewIsSupported("GL_EXT_framebuffer_object"){
printf("Old EXT FBO available
");
}
if (glewIsSupported("GL_ARB_framebuffer_object"){
printf("Newer ARB FBO available
");
}
if (glewIsSupported("GL_EXT_framebuffer_object"))
cout<<"Old EXT FBO available"<<endl;
else
cout<<"Old EXT FBO NOT available"<<endl;
if (glewIsSupported("GL_ARB_framebuffer_object"))
cout<<"Newer ARB FBO available"<<endl;
else
cout<<"Old ARB FBO NOT available"<<endl;
and the result was NOT supported in both cases. How is this possible? I was using GL_EXT_framebuffer_object few days ago until I link with OpenCL libraries.
New Test:
err = glewInit()
if (GLEW_OK != err)
{
const GLubyte *e = glewGetErrorString(err);
fprintf(stderr, "Error: %s
",glewGetErrorString(err));
}
if (glewIsSupported("GL_EXT_framebuffer_object"))
cout<<"Old EXT FBO available"<<endl;
else
cout<<"Old EXT FBO NOT available"<<endl;
if (glewIsSupported("GL_ARB_framebuffer_object"))
cout<<"Newer ARB FBO available"<<endl;
else
cout<<"Old ARB FBO NOT available"<<endl;
So, none worked because you forgot the glewInit ?
Then EXT is available ? And now, when you get function pointer for glGenFramebuffersEXT, is it null or not ?