PDA

View Full Version : How to retain previous image in the frame buffer



fred21
09-07-2011, 07:24 AM
Hi
I would like to load a model and then render it, I would then like to move the model and render it again but still keep an image of the initial rendering on the screen.(Displaying two of the model)

Is it possible to add further information to the framebuffer without deleting the previous contents.

Any pointers in the right direction would be greatly appreciated.

all the best

fred

BionicBytes
09-07-2011, 07:50 AM
Sounds like you would be best rendering to an offscreen buffer and then that is automatically available as a texture afterwards. Look up Frame Buffer Objects (which is an extension for GL 2.x, but part of core GL 3.x).
Another way would be to copy the main window to a texture after you have initially drawn the model.
This method has the advantage that it's available no matter which GL version you are using and is dead simple to implment:


glBindTexture (GL_TEXTURE_2D, texture.id);
glCopyTexSubImage2D(GL_TEXTURE_2D,0,0,0, 0,0,texture.image.sizex, texture.image.sizey);

fred21
09-07-2011, 08:06 AM
Thanks for that i'll take a look