Render to Texture.

When my program loads I need to generate some textures. What I would like to do is draw some textured polygons onto this texture. I’m right in asssuming that I should specify the texture as a render target and then just draw polygons as normal? I’m a little confused about the actually implimentation of this, any tutorials around?

In this case there is a problem: If you render one polygon directly on top of another polygon, the depth buffer doesn’t work correctly.In this case you should use from the stencil buffer to get a cool result.
The instructions about the decaling are here:
http://www.opengl.org/resources/tutorial…000000000000000

-Ehsan-

i think what you want is a pbuffer…

there’s a brief description here (around page 5)

if you dont have the extension on your GPU you need to render to the screen then use glTexSubImage2D(…)
(documented on msdn ) to grab the image to the active texture unit.
use glFlush(); rather than swap buffers before you grab to ensure that the render completed. then you can clear the back buffer (or frame) before rendering the final image.