PDA

View Full Version : Redraw buffer



Cronky
06-05-2011, 02:20 PM
Is it possible to redraw the last framebuffer image state rather than doing a full redraw? A copy and redraw of the last framebuffer for instance? I am dealing with a lot of GL_POINTS that I am drawing every frame and it would be ideal in certain cases to just continually draw the last frame image and not have to parse through all of the vertex data. For example, a hit detection implementation would operate much quicker on the point data if the only rendering that needed to be done was a copy/redraw of the front buffer. This design is not for a game, so rotation/translation responsiveness are not as important. I apologize in advance if this question has been asked/answered before, I was unable to find a similar thread in the forums.

dukey
06-05-2011, 03:50 PM
Yeah
I *think* you can do this when you create an OpenGL window

PFD_SWAP_COPY
http://msdn.microsoft.com/en-us/library/dd368826%28VS.85%29.aspx

Although never used it myself. No idea how fast it is, you might be better off drawing to back buffer, capturing to a texture then redrawing that.

dorbie
06-05-2011, 04:02 PM
This is not always supported. You can always use readpixels and drawpixels. You may or may not want to clear the depth buffer depending on the nature of your application.

Ilian Dinev
06-05-2011, 04:13 PM
glCopyTexSubImage2D

BionicBytes
06-06-2011, 01:50 AM
Draw your points to an off-screen Frame Buffer Object which has a colour texture attached (and also include a depth texture/render buffer if required). When you you need to draw the scene you can blend this FBO texture to the main window as a full-screen quad.

Alternatively, you could draw the points first to the main back buffer. Grab a copy of the window's contents using glCopyTexSubImage2d. Again this texture could then be blended into the main scene instead of drawing all the points every frame.

_arts_
06-06-2011, 06:04 AM
Why not simply not clear/swap buffers ?

Cronky
06-09-2011, 09:23 AM
Appreciate the suggestions guys, this is how I got mine to work. Creating and setting a bool initialized to false, after the frame draws itself I then set the flag to true. On each draw frame test if the frame has been drawn before, if it has....
{
[(EAGLView *)self.view presentFramebuffer];
return;
}

if it has not been drawn
{
[(EAGLView *)self.view setFramebuffer];
}
and proceed with draw routine.

I then test for touches setting my bool to false if I need to rot/trans/fov etc. I am working in the OGLES side.