PDA

View Full Version : Render to texture



Guardian
02-16-2002, 07:35 PM
I wonder if there is a function that would enable someone to take a screen shot while scaling to the destination buffer size.

I meen I would like to have a function that copy the frame buffer data to a texture while scaling to the texture dimensions

The only solution I found is to set up a buffer with the screen dimensions, read back the pixels, scale , and write back to a texture using glTexSubImage2D. The overall process is pretty slow.

Thx for any help
Guard][an

Damon
02-17-2002, 02:54 AM
Originally posted by Guardian:
I wonder if there is a function that would enable someone to take a screen shot while scaling to the destination buffer size.

Well, you could certainly re-draw the scene at the smaller size in the back buffer then copy it to a texture 1:1.


[This message has been edited by Damon (edited 02-17-2002).]

ScottManDeath
02-17-2002, 04:28 AM
Hi

perhaps you should look at the WGL_ARB_pbuffer extension. There you can create an offscreen buffer with e.g. 100x100 size and render to it as normal. THen you can use glCopyTeximag2d to copy it to a texture.
See also nvidas openglsdk/effectsbrowser

Bye
ScottManDeath

Guardian
02-17-2002, 05:37 AM
Hum, I can't render the scene twice, because the part of code which needs the screenshot in the texture knows nothing about how the previous stuff was drawn.

I would be nice to have this scaling in hardware
Guard][an

jwatte
02-17-2002, 06:33 AM
You _could_ just call the function that renders the scene twice, just like with, say, dynamic cube maps. Like so:

set render size to 128x128

render scene without needing the texture

glCopyTexSubImage

set render size 800x600 (or whatever)

render scene from scratch; when getting to the part where you need the small texture, use it.

chrisATI
02-17-2002, 10:48 AM
Originally posted by Guardian:
I wonder if there is a function that would enable someone to take a screen shot while scaling to the destination buffer size.

I meen I would like to have a function that copy the frame buffer data to a texture while scaling to the texture dimensions

The only solution I found is to set up a buffer with the screen dimensions, read back the pixels, scale , and write back to a texture using glTexSubImage2D. The overall process is pretty slow.

Thx for any help
Guard][an

You could render to an off screen buffer (pbuffer) and then bind this buffer as a texture. Here's a white paper describing this technique:
http://www.ati.com/na/pages/resource_centre/dev_rel/ATIpbuffer.pdf

h2
02-18-2002, 06:21 AM
chrisATI

Are you awared of such possible bugs in your ICD:
1. I have to bind pbuffer to texture every time I want to bind texture. I believe it have to be done just once.
2. When I try to use render_texture extension or simply copy image from pbuffer (via glCopyTexSubImage), and after that I use this texture with envmap_bumpmap extension, machine hangs. This happens only on R200, on R100 everything is ok.