Mark Harris
RenderTexture is a class that supports the use of pbuffers for off screen rendering in OpenGL. RenderTexture supports several render target idioms: Render to Offscreen Buffer, Render To Texture (RTT), and Render to Depth Texture (RTDT). RTT and RTDT can optionally be done using a copy (glCopyTexSubImage2D), rather than using the WGL_ARB_render_texture extension. Textures may be power-of-two-dimensioned (POTD) or non-power-of-two-dimensioned (NPOTD).

Texture internal formats supported include DEPTH_COMPONENT_NV, RGB8 (POTD or NPOTD), RGBA8 (POTD or NPOTD), R5G6B5 FLOAT_R, FLOAT_RG, FLOAT_RGB, and FLOAT_RGBA (all NPOTD). On NV30, both 16 and 32 bit float formats are supported. (Update 9/18/03: Other fixed-point formats may be supported now. YMMV.)

GLEW is required for extension querying.

As of 9/18/03 This class has been tested under windows on GeForce 4 Ti, GeForce FX and Quadro FX, with drivers from 41.09 to 44.65. It has also been tested on ATI Radeon 9700 with Catalyst 3.0 drivers. Currently on ATI only POTD textures are supported. As of 9/20/03 Linux Copy-to-texture support is added. If you add features or port to other OSes,


  • (9/20/03) Fixed a GLEW bug that I inserted in the last version. Also, Eric Werness contributed some linux support. I didn't know it, but Linux doesn't actually support the ARB_render_texture extension yet. So CTT must be used in Linux. No Linux depth texture support yet.
  • (9/18/03) Updated with several bug fixes from Daniel Sperl and Bill Baxter. R5G6B5 fixed-point format now works. RTDT works now even if you don't also request RTT (useful for shadow maps). Also, RTDT now works on older ATI cards (notably the ATI Mobility Radeon 9000) via emulation with glReadPixels. This is slow, but it allows testing on some laptops. I also added two new example projects that demonstrate RTT and RTDT without using Cg. The original examples that used Cg are retained. Linux Support is coming soon...
  • (9/15/03) Updated to work with the new GLEW interface.
  • (5/1/03) I removed the annoying error messages that RenderTexture sometimes printed even when there were no errors related to RenderTexture.


  • Original Code: Mark Harris
  • Linux CTT Support: Eric Werness
  • RTDT support: Thorsten Scheuermann
  • Bug Fixes and Miscellaneous: Daniel Sperl, Bill Baxter
Mark Harris Page