PDA

View Full Version : Taking a screenshot of a moving object and antialias the screenshot



pmatos
11-23-2003, 01:48 PM
Hi all,

I have a moving object in my framebuffer... Imagine a cube moving in space and I want to take a screenshot of it and antialias it using the accumulation buffer like it is described in the redbook, framebuffer chapter. But the problem is I would like to keep the cube moving but the screenshot should not stop the cube, the screenshot and the antialias should be done in the background.

First I though of using readPixels when taking the screenshot and getting it to memory and antialias the image on memory but that is not possible with the accumulation buffer since I think I need to draw the objects in the buffer and then accumulate (that's what the displayObjects does, page 454). So, how can I do that? It seems impossible. Is it?

Best regards,

Paulo Matos

CatAtWork
11-23-2003, 03:54 PM
The image you see on the screen is what's captured. Just go ahead and use your normal screenshot code.

pmatos
11-24-2003, 01:30 AM
The problem is not capturing the screenshot but the antialiasing because I capture at time t, then I'll accumulate at time t+1, t+2, etc, and at those times since the picture is in motion, I'll get the screenshot blurred!

If the objects were static everything in my program would be just working great, however, things are not static! Any ideas?


Originally posted by CatAtWork:
The image you see on the screen is what's captured. Just go ahead and use your normal screenshot code.

M/\dm/\n
11-24-2003, 04:12 AM
Render scene to texture, draw opaque poly that fills the screen & then draw partialy transparent polys 4,8,16,100,10000000 times if you wish with slightly shifted coords (no accu at all). Or use fp (many posibilities there).

pmatos
11-24-2003, 05:31 AM
I did that, it is called jittering afaik. However, the problem is that I don't know how to do that in a color buffer which is not visible to the user.

How can I write to a buffer which is not visible to the user? Do the antialiasing there while everything runs smoothly to the user?


Originally posted by M/\dm/\n:
Render scene to texture, draw opaque poly that fills the screen & then draw partialy transparent polys 4,8,16,100,10000000 times if you wish with slightly shifted coords (no accu at all). Or use fp (many posibilities there).

M/\dm/\n
11-24-2003, 06:30 AM
1st approach:
IF you have double buffering



void your_render_loop(void)
{
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
//render the stuff here
glReadPixels();//SLOW AS HELL http://www.opengl.org/discussion_boards/ubb/biggrin.gif
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
draw poly with texSubImage2D(the stuff from readpixels)
draw the poly 100x more
//////////////AND NOW
glSwapBuffers();
}

2nd approach:
Or you can render to texture via using pbuffers, then switch rendering to classic color buffer & use thexture you've made in pbuff. + http://oss.sgi.com/projects/ogl-sample/registry/ARB/wgl_render_texture.txt

[This message has been edited by M/\dm/\n (edited 11-24-2003).]

pmatos
11-24-2003, 06:43 AM
Originally posted by M/\dm/\n:
1st approach:
IF you have double buffering



void your_render_loop(void)
{
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
//render the stuff here
glReadPixels();//SLOW AS HELL http://www.opengl.org/discussion_boards/ubb/biggrin.gif
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
draw poly with texSubImage2D(the stuff from readpixels)
draw the poly 100x more
//////////////AND NOW
glSwapBuffers();
}

2nd approach:
Or you can render to texture via using pbuffers, then switch rendering to classic color buffer & use thexture you've made in pbuff. + http://oss.sgi.com/projects/ogl-sample/registry/ARB/wgl_render_texture.txt

[This message has been edited by M/\dm/\n (edited 11-24-2003).]

Hummm, I don't know how this will work
since I think I can jitter with glTexSubImage2D using xoffset and yoffset parameters but I cannot accumulate them (with the same weights for each poly rendering to achieve good antialiasing), can I?

Hummm, maybe I can, If I read the pixels with readPixels, then I glTexSubImage2D to a buffer with some given offset and accumulate that buffer... http://www.opengl.org/discussion_boards/ubb/biggrin.gif I think it works, what do you think?

Best regards,

Paulo Matos