buffer question

Hi, i would like to use the color buffer to use a dynamic texture.
At each frame, i would like to do:

//****
glClear(GL_COLOR_BUFFER_BIT);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, My_Texture);
glBegin(GL_QUADS);
Draw my quads;
glEnd();

//**** copy the buffer in another texture.
glBindTexture(GL_TEXTURE_2D, AnotherTexture);
glCopySubTexImage2d(GL_TEXTURE_2D, blablabla);

//****

My problem is that i want to copy an area of the buffer but i don’t know which one.

how do i know the area of the buffer i should use to be sure that i only take my quads???

THANKS
JC

The position is depending on your modelview and projection matrix.
If the matrices are simple orthogonal projections, you should know beforehand where the quads come out on the screen.

If perspective projection is involved you either have to do the transformations yourself or let gluProject do this for you.

Yes, but the position in the buffer are in pixels and the positions of my quads are not in pixels but in the local base.

I don’t understand how i can do the changing of base position —> pixels ???

Do u have an exemple of this??

Here is the link to the gluProject help: http://msdn.microsoft.com/library/psdk/opengl/glufnc01_4mno.htm

You need your quad vertices (in local base == model space?), the two matrices, and the viewport. gluProject delivers the final positions on the screen.
Gather the coordinates and take the bounding box. That’s the region you might want to update.
If there is any relation between texture size and viewport size intended, calculate the positions accordingly (linear interpolation).

Hope that helps.