View Full Version : Render to texture
03-02-2003, 05:39 AM
I've downloaded some render to texture demos. It explain only how to render to a black textured quad. Anyone know how to render to a normal textured quad ( with an image applyed on it ) ?
03-03-2003, 03:38 PM
There are loads of demos on my site that uses render to texture. http://esprit.campus.luth.se/~humus/
03-04-2003, 12:11 PM
Why don't you give him an answer rather than giving him links while the answer is simple? :P
Generate a texture, using glGenTexture() draw your scene to a power of two viewport, bind the texture then copy the data using glCopyTexSubImage() ... not sure if this is the exact name of the function though http://www.opengl.org/discussion_boards/ubb/smile.gif
Hope this helps
03-04-2003, 01:41 PM
Daher, that's not render-to-texture, that's render-to-backbuffer-then-copy-to-texture.
So your simple answer was wrong.
The "simple" answer is to do it the same way as the samples that render to the black quad. Only instead of using glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) you just do glClear(GL_DEPTH_BUFFER_BIT) then draw your textured quad (disable depth writes) and then any overlays (that were previously drawn over the black quad).
Basically you just have to remember that it doesn't matter what you draw to your pbuffer/texture.
And Daher, just giving links promotes a bit of self education instead of the usual "can you give me the answer".
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.