# glGenFramebuffersEXT

This topic is 3404 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, This is the first time i look into framebuffers, but even the first command goes terribly wrong. consider the following program:
#include <iostream>
#include <GL/glew.h>
#include "glut.h"
GLuint fbo;
int main(int argc, char* argv)
{
/*
glutInit(&argc, &argv);
glutInitDisplayMode (GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
glutInitWindowSize (500, 500);
glutCreateWindow ("window title");
*/

if (glewGetExtension("GL_EXT_framebuffer_object") == GL_TRUE){
std::cout << "FBO supported" << std::endl;
getchar();
glGenFramebuffersEXT(1,&fbo);
}
else{
std::cout << "FBO not supported" << std::endl;
getchar();
}
return EXIT_SUCCESS;
}


what happens: - as it is, it outputs FBO not supported. - If I uncomment the lines for initialising the glut window, it will output "FBO supported", but then as i press a key, I get an access violation exception for the glGenFramebuffersEXT function. Could someone please explain to me, what exactly is going on there? I do not get why initialising a glut window affects the framebuffer and neither do i get, why it crashes even though it is supported. btw: I use a geforce8800gts512 Thanks for any help, RonD

##### Share on other sites
Quote:
 Original post by RonD- If I uncomment the lines for initialising the glut window, it will output "FBO supported

It is normal that you get this error if no OpenGL context has been created. If I'm not mistaking, you could create such a context using different graphics card available on your computer, and not all of them may support FBOs. Because of this, you can't know if FBOs (or any other extension) is available without having created an OpenGL context (which glut does, most likely in glutCreateWindow).

Quote:
 Original post by RonD[...] but then as i press a key, I get an access violation exception for the glGenFramebuffersEXT function.

In order to diagnose this, we'll need to know how you queried the entry point for the glGenFramebuffersEXT function. You're most likely calling a NULL or undetermined function pointer. Check if your function pointer is NULL before calling it and tell us how your got that function pointer in the first place (wglGetProcAddress? GLEW?).

EDIT: I see you're using GLEW, I haven't used it but don't forget to call glewInit() as seen here.

##### Share on other sites
sorry, you were right. I forgot to init glew

• 10
• 18
• 14
• 18
• 15