I am trying to use glScissor to select only those parts of the screen that need updating. I have a playground where I need to update every frame, but the user interface area needs to be updated much less frequently. The game area is beautiful, but the user interface area constantly flickers with what looks like old buffer data.
What am I missing?
Here is my rendering code:
[EAGLContext setCurrentContext:context];
glBindFramebufferOES(GL_FRAMEBUFFER_OES, viewFramebuffer);
if (needsUIUpdate)
{
glScissor(0, 0, 320, 480);
glClear(GL_COLOR_BUFFER_BIT);
needsUIUpdate = NO;
[self updateUI];
}
else
{
glScissor(0, 80, 320, 400);
glClear(GL_COLOR_BUFFER_BIT);
}
for (Cell* c in allCells)
[c animate];
glBindRenderbufferOES(GL_RENDERBUFFER_OES, viewRenderbuffer);
[context presentRenderbuffer:GL_RENDERBUFFER_OES];
source
share