PDA

View Full Version : FBO initialisation causes segfault



kingc8
06-17-2010, 06:28 AM
Hello,

I'm migrating from glCopySubTex() to FBO.

I am not using GLUT.

I'm using GLEW and GLFW but all the examples I've seen of FBO use GLUT so it could be initialising something I'm not.

My includes are:

#define GL_GLEXT_PROTOTYPES
#include <GL/glew.h>
#include <GL/glfw.h>

All compiles fine.

But it crashes on the attempt to generate the framebuffer object. Google tells me its because the FBO isn't initialised properly, but I expected GLEW to do that for me. Why is it crashing?

static GLuint fbo[1];
...
glGenFramebuffers(1, fbo); // set-up fbo

Thanks for any help.

Cameron

strattonbrazil
06-17-2010, 08:23 AM
Make sure you're extensions are properly loaded. If you print out glGenFramebuffers itself, you'll probably see it's zero instead of some position in memory you'd expect. It's because glGenFramebuffers itself hasn't been initialized.

Did you call glewInit and did it return any errors?
http://glew.sourceforge.net/basic.html

kingc8
06-17-2010, 09:04 AM
Yes, glGenFramebuffers returned zero.

In checking the glewInit it returned the error "Missing GL version".

I found the problem, I moved the glewInit after the glfwOpenWindow call which then worked.

I was initialising GLEW too early.

Thanks for your help.

Cameron