PDA

View Full Version : Render to Texture.



Lehm
06-11-2005, 10:17 AM
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?

Ehsan Kamrani
06-11-2005, 03:36 PM
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 (http://www.opengl.org/resources/tutorials/advanced/advanced98/notes/node243.html#SECTION000162000000000000000)

-Ehsan-

carl_lewis
06-12-2005, 10:31 PM
i think what you want is a pbuffer...

there's a brief description here (http://www.daimi.au.dk/~mosegard/GPGPU_E04Material/slides0411.pdf) (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 (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/opengl/glfunc03_2bqc.asp) ) 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.