OpenGL ES Template: createFramebuffer called several times?
Hi, I'm having some difficulty understanding what the OpenGL ES template is trying to do.
I want to initialise my OpenGL matrix etc in one place. Up until now I've had an InitGL() call within my createFrameBuffer method. It wasn't until I noticed a bug on the iPhone that wasn't in the Windows version of my app that made me realise my InitGL() function was being called twice.
Since then I've hacked things somewhat by adding a global flag to stop my function being called twice.
Can somebody please tell me why mulitple calls to createFrameBuffer are made? Does this have something to do with the application splash screen display? (which I'm not displaying at present).
I want to initialise my OpenGL matrix etc in one place. Up until now I've had an InitGL() call within my createFrameBuffer method. It wasn't until I noticed a bug on the iPhone that wasn't in the Windows version of my app that made me realise my InitGL() function was being called twice.
Since then I've hacked things somewhat by adding a global flag to stop my function being called twice.
Can somebody please tell me why mulitple calls to createFrameBuffer are made? Does this have something to do with the application splash screen display? (which I'm not displaying at present).
Code:
int g_Done = 0;
- (void)createFramebuffer
{
if (context && !defaultFramebuffer)
{
[EAGLContext setCurrentContext:context];
// Create default framebuffer object.
glGenFramebuffers(1, &defaultFramebuffer);
glBindFramebuffer(GL_FRAMEBUFFER, defaultFramebuffer);
// Create color render buffer and allocate backing store.
glGenRenderbuffers(1, &colorRenderbuffer);
glBindRenderbuffer(GL_RENDERBUFFER, colorRenderbuffer);
[context renderbufferStorage:GL_RENDERBUFFER fromDrawable:(CAEAGLLayer *)self.layer];
glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_WIDTH, &framebufferWidth);
glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_HEIGHT, &framebufferHeight);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, colorRenderbuffer);
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
NSLog(@"Failed to make complete framebuffer object %x", glCheckFramebufferStatus(GL_FRAMEBUFFER));
// PDS: This should only be called once.. but its not..
if( ! g_Done )
{
InitGL();
g_Done = 1;
}
}
}| Messages In This Thread |
|
OpenGL ES Template: createFramebuffer called several times? - SparkyNZ - Apr 13, 2011 06:01 PM
RE: OpenGL ES Template: createFramebuffer called several times? - iamflimflam1 - Apr 16, 2011, 09:10 AM
RE: OpenGL ES Template: createFramebuffer called several times? - SparkyNZ - Apr 16, 2011, 02:46 PM
|
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Xcode 4 OpenGL Game Template Question | Macmenace | 4 | 4,986 |
Mar 19, 2012 06:03 PM Last Post: Macmenace |
|
| SDL1.3 Audio with OpenGL ES Template | SparkyNZ | 1 | 4,310 |
Apr 14, 2011 11:36 AM Last Post: SparkyNZ |
|
| typedef struct - lossing data on some levels at random times | jjslay | 6 | 3,621 |
Jun 26, 2010 02:36 PM Last Post: jjslay |
|
| Submitting Updates to iTunes Connect and Review Times | Bersaelor | 4 | 8,610 |
May 26, 2010 09:51 AM Last Post: AnotherJake |
|
| Long shader compile times on iPhone 3G S | conal | 9 | 5,565 |
Nov 20, 2009 03:54 AM Last Post: OneSadCookie |
|

