Iterate on previous result?

NO,Mazy,that way only add the current and (current -1 ) pixel value.Not all the previous pixels.

Mazy,Have you test it ?

if you store to the same place you read from you will get the sum of all pixels. if you only get the sum from this pixel and pixel-1 then you dont render to the same target as you read from.

Mazy:I have bound and rendered with the same floating buffer.But only current and (current-1) are added.The code is:
//we are already in the floating point buffer.Then:
glBindTexture(GL_TEXTURE_RECTANGLE_NV, fptexture);
glCopyTexSubImage2D(GL_TEXTURE_RECTANGLE_NV, 0,0,0,0,0, core_image_x_width,core_image_y_width);
glBindProgramARB(GL_FRAGMENT_PROGRAM_NV, simple_sum);
glEnable(GL_FRAGMENT_PROGRAM_NV);
glBindTexture(GL_TEXTURE_RECTANGLE_NV, fptexture);
glEnable(GL_TEXTURE_RECTANGLE_NV);
for(i=1;i<image_x_width;i++)
{
glBegin(GL_QUADS);
glTexCoord2f(i-1, 0.0f);glVertex2f(i-1, 599);
glTexCoord2f(i, 0.0f);glVertex2f( i, 599);
glTexCoord2f(i, image_y_width);glVertex2f( i, 600-image_y_width);
glTexCoord2f(i-1, image_y_width);glVertex2f(i-1, 600-image_y_width);
glEnd();
}
Note:image_y_width=image_x_width=512;Driver version is 52.16.
Have you ever tested it successfully?

Originally posted by Mazy:

however, i havent tried it, and one that tried says it doenst worked for him, and the spec about render to texture states that this kind of rendering result in an undefined behaivour… but if you are bound to nvidia HW and want to try it, go ahead.

the technique is briefly described in
http://developer.nvidia.com/docs/IO/8230/GDC2003_SummedAreaTables.pdf

so i guess it has worked on nVidia HW/drivers some time atleast.

[This message has been edited by Mazy (edited 12-15-2003).]

Originally posted by Mazy:
[b]
the technique is briefly described in
http://developer.nvidia.com/docs/IO/8230/GDC2003_SummedAreaTables.pdf

so i guess it has worked on nVidia HW/drivers some time atleast.

[This message has been edited by Mazy (edited 12-15-2003).][/b]

Thanks, Mazy.
I will study it carefully.

Since I’m the one who seems to have first described this technique (texturing from an active render target), I should probably point out that it is purely experimental and is not guaranteed to work on future hardware.

Even on current hardware it can fail depending on the shader used. The problem is that there is no guarantee that rendering has completed and the texture cache contents are valid by the time the texture is read on the next pass.

It is possible that in the future we might be able to support an extension that makes the synchronization more explicit.

Until then, the only “legal” way to do this is to use two pbuffers, and ping-pong between them. You also need copy the changes back from one pbuffer to the other each pass. To avoid context switching overhead you can create a double-buffered pbuffer and bind the front and back buffers as separate textures.

Originally posted by Mazy:
[b]
the technique is briefly described in
http://developer.nvidia.com/docs/IO/8230/GDC2003_SummedAreaTables.pdf

so i guess it has worked on nVidia HW/drivers some time atleast.

[/b]

[This message has been edited by simongreen (edited 12-16-2003).]

Thanks,simongreen.That explains why I can not get your result of so many efforts.I will not try it any more.