View Full Version : Using glReadPixels and glDrawPixels

11-11-2009, 09:14 PM
Hi all, I'm new to OpenGL and learning fast ;)

I have a section on my screen that take allot of CPU to create.
I would like to just calculate the drawing once and just reuse it.
If i have to recalculate the drawing every time I render, it can max out the cpu.

I've been looking into glReadPixel and glDrawPixel.
I would like to grab a rectangle off the screen after the screen is drawn and just glDrawPixel it any time I want to render new objects on top of it.

However I'm having no success and have not been able to find any examples on Google. any help is appreciated.

11-12-2009, 12:32 AM
Instead of glRead/draw pixels Youre better off creating a texture the same size as u want
and then using
glCopyTexSubImage2d(...) to copy from the screen into the texture + then drawing the texture to the screen subsequently.

The reason being is drawing textures is faster/less CPU intensive than drawing pixels