PDA

View Full Version : glBindFramebuffer causes app to not respond



EdKeens
11-11-2013, 10:25 AM
Hello,
I'm trying to run my opengl app on other computers. Everything runs ok on my PC, however when I tried it elsewhere, glBindFramebuffer causes app to not respond. Here's full source code:


// setting opengl attributes for SDL
SDL_GL_SetAttribute( SDL_GL_CONTEXT_MAJOR_VERSION, 3 );
SDL_GL_SetAttribute( SDL_GL_CONTEXT_MINOR_VERSION, 2 );
SDL_GL_SetAttribute( SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE );

// inti sdl
if(SDL_Init(SDL_INIT_EVERYTHING) < 0) {
return false;
}
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 8);
// create windows
if((screen = SDL_CreateWindow("Color Wars", 100, 100, 1024, 600, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN)) == NULL) {
return false;
}

// opengl context
if ((gl_context = SDL_GL_CreateContext(screen)) == NULL)
{
return false;
}

SDL_GL_SetSwapInterval(1);
// return false;
glewExperimental = GL_TRUE;

if (glewInit() != GLEW_OK)
{
return false;
}
glEnable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glEnable(GL_TEXTURE_2D);
glEnable(GL_CULL_FACE);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

glBindFramebuffer(GL_FRAMEBUFFER, 0);

When I delete last line, everything works. Does anyone have a clue what's happing? Thank you for your help in advance.

Ehsan Kamrani
11-12-2013, 12:11 PM
It seems that FBO is not supported by those machines.I always check FBO extension before calling its functions.

carsten neumann
11-12-2013, 12:17 PM
Did you check what OpenGL version GLEW thinks is available, e.g. using if(GLEW_VERSION_3_2) ? The symptom looks like a not initialized function pointer, which could be the case if GLEW believes you have an OpenGL context that does not support glBindFramebuffer. Also, does SDL activate the OpenGL context directly after creating it (glewInit() must have an active context to work)?