Can I use backbuffer as a texture? How to do?

Hi,

I want to use part of my render image as a texture to simulate mirror effect, what shall I do.

Thanks

Have a look at glCopyTex(Sub)Image2D.

Or
http://oss.sgi.com/projects/ogl-sample/registry/ARB/wgl_render_texture.txt

(will give performanec problems on some cards)

If you are sure that your window won’t be obscured by menus or dialog boxes,during the rendering of the scene you wish to grab, you’ll be able to use the backbuffer as a source for you texture using glCopyTexSubImage2D. If however there is the potential for menus/dialogs obscuring portions of the display then depending upon the OpenGL driver you could suffer from pixel ownership problems, and thus cannot rely on the contents of the backbuffer not having “holes” where the dialogs are.

Your best bet would probably be to use PBuffers, or render to texture if they are supported, Or make sure that the dialogs/menus don’t obscure your canvas.

Heath.

Thanks, but glCopyTex(Sub)Image2D and render to texture can’t deal with 1024x768 image, it only support 1024,512,256…

Then either use WGL_NV_render_texture_rectangle or use a 1024x1024 texture and adjust your texture coordinates appropriately to only use 1024x768.