PDA

View Full Version : render to texture



Lord crc
04-17-2001, 05:37 PM
just curious, how do you render to a texture? any web pages or similar apprechiated

btw, is it fast enough to allow for several such (say 256x256) textures to be rendered (assuming the geometry is not massive)

Dodger
04-17-2001, 06:16 PM
Look into glCopyTexImage2D() or glCopyTexSubImage2d(). Both copy from the frame buffer to a texture object, this is the only 'clean' solution in OpenGL to render to a texture. In current hardware implementations both are pretty fast.
Also, if that is possible (depends on what you want to do with the rendered textures), try to turn the detail level as low as possible when rendering the textures, turn texture mapping off, etc. I'm working on a 3D engine that implements reflection mapping this way and generally I'd say it's pretty fast.

Lord crc
04-17-2001, 06:40 PM
lemme just check to see if i got this

change to texture's "camera" (thus updating matrix and glViewport), render, do a glCopyTexImage2D into a texture, repeat as neccessary

change to main "camera", render, swap buffers

or?

AndersO
04-17-2001, 10:16 PM
Check out the pbuffer extension, though the only cards that I think support it is nvidias.

Nutty
04-18-2001, 07:41 AM
You might wanna have a look at some code I did. A dynamic cube mapping example, which renders into the backbuffer, and updates the textures each frame.

It's on www.nutty.org (http://www.nutty.org) in the extension section.

Nutty

DanO
04-18-2001, 08:43 AM
Originally posted by AndersO:
Check out the pbuffer extension, though the only cards that I think support it is nvidias.

The ATI Radeon and Rage 128 supports the pbuffer extension as well.