views:

460

answers:

0

Does anyone know why this may happen:

I draw to a 2D screen using glDrawArrays with GL_POINTS (interleaved array). If I flip the buffers (presentRenderbuffer) after ever call to glDrawArrays -- so after each "tile" is drawn -- everything works fine.

This is, of course, inefficient.. so if I move the presentRenderBuffer outside of the draw loop, I get the errors. Basically parts of the screen just don't draw, and it's always in the same place (the middle of the screen, horizontally).

I'm using retainedbacking (as I update only tiles that changed) so I need to rely on the frame buffer staying the same between draws so I can draw over it.

Any ideas why presentRenderBuffer after each tile works fine, while one final presenRenderBuffer after all of the draws wouldn't?

EDIT: Also, adding glFlush() in the tile draw loop, and moving presentRenderBuffer outside the loop produces the correct image as well.