views:

32

answers:

1

I'm trying to create an offscreen framebuffer into which I can do some OpenGL drawing, and then pull the bits out manually. I'm following the instructions here, but in step 4, status is 0 instead of GL_FRAMEBUFFER_COMPLETE_OES.

If I insert a call to glGetError() after every gl call, it returns 0 (GL_NO_ERROR) every time. But, the values of variables do not change during the call. E.g.,

GLuint framebuffer;
glGenFramebuffersOES(1, &framebuffer);
glBindFramebufferOES(GL_FRAMEBUFFER_OES, framebuffer);

the value of framebuffer does not get altered at all (even when I change it to some arbitrary value and re-execute). It's almost like the gl calls are not actually being made. I'm linking against OpenGLES framework, and get no compile, link, or run-time errors (or warnings).

I'm at a loss as to what to do next. I've tried continuing on with my drawing, but do not see the results I expect, but at this point I can't tell whether it's because of the above error, or the conversion to a UIImage.

A: 

This sounds like you don't have an active GL context when you try to create the FBO.

Edit: For the sake of completeness, here's how to create an OpenGL ES 1.1 context and activate it:

EAGLContext* myContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES1];
[EAGLContext setCurrentContext: myContext];
Maurice Gilden
Can you elaborate? I thought creating the FBO was what was giving me the GL context for me to draw into.Yes, I am an OpenGL newbie.
randallmeadows
Never mind...I figured out what you meant, and yes, that was indeed the problem. Now to figure out why the end result is all black. Thanks.
randallmeadows