PDA

View Full Version : Apple's GLSprite OpenGL ES Sample App




shusseina
Apr 7, 2009, 10:50 AM
I am going through Apple's GLSprite OpenGL ES sample app attempting to figure out how the code works.

In EAGLView.m there is method createFrameBuffer:

- (BOOL)createFramebuffer
{
glGenFramebuffersOES(1, &viewFramebuffer);
glGenRenderbuffersOES(1, &viewRenderbuffer);

glBindFramebufferOES(GL_FRAMEBUFFER_OES, viewFramebuffer);
glBindRenderbufferOES(GL_RENDERBUFFER_OES, viewRenderbuffer);
[context renderbufferStorage:GL_RENDERBUFFER_OES fromDrawable:(id<EAGLDrawable>)self.layer];
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_RENDERBUFFER_OES, viewRenderbuffer);

glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &backingWidth);
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &backingHeight);

if(glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES) != GL_FRAMEBUFFER_COMPLETE_OES) {
NSLog(@"failed to make complete framebuffer object %x", glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES));
return NO;
}

return YES;
}


What do the procedure calls glGenFramebuffersOES and glGenRenderbuffersOES do?

I see they are in the OpenGLES framework (OpenGLES.framework/Headers/ES1/gl.h), but I can't find either in Apple's documentation under Xcode, on their Developer site or in the man pages on khronos.org, which makes it difficult figuring out how the code works.



johnnyjibbs
Apr 7, 2009, 11:20 AM
I'm flumuxed by it too because it's Open GL code, which I have no idea where to find any decent info on. You'll have to buy a book on it I'm afraid if you want to do 3D games.

shusseina
Apr 9, 2009, 06:56 PM
The following link provides some info (search for GenFramebuffersOES or GenRenderbuffersOES):

http://www.khronos.org/registry/gles/extensions/OES/OES_framebuffer_object.txt

The following is a more general link:

http://www.khronos.org/registry/gles/