Enlarging areas of the screen (for huge screenshots) ?

Hello, I need to be able to take very large screenshots (larger than the card can render), so I was wondering if there was a way to blow up just an area of the screen without changing perspective. I could then screenshot that and repeat for each area of the screen until the desired resolution is reached.

Is that possible? If not, does someone have an alternate solution?

Try this:

GLfloat proj[16];
glGetFloatv(GL_PROJECTION_MATRIX, &proj[0]);

glMatrixMode(GL_PROJECTION);
glPushMatrix();

for ( int x = 0; x < xgrid ; ++x )
    for ( int y = 0; y < ygrid ; ++y )
    {
        glLoadIdentity();
        glTranslatef(xgrid-2.0*x-1,ygrid-2.0*y-1,0.0);
        glScalef(xgrid,ygrid,1);
        glMultMatrixf(&proj[0]);

        //take screenshot here
    }

glPopMatrix();

Where xgrid and ygrid represent the subdivisions along the x and y axes.

Nico

Originally posted by -NiCo-:
[b]Try this:

GLfloat proj[16];
glGetFloatv(GL_PROJECTION_MATRIX, &proj[0]);

glMatrixMode(GL_PROJECTION);
glPushMatrix();

for ( int x = 0; x < xgrid ; ++x )
for ( int y = 0; y < ygrid ; ++y )
{
glLoadIdentity();
glTranslatef(xgrid-2.0x-1,ygrid-2.0y-1,0.0);
glScalef(xgrid,ygrid,1);
glMultMatrixf(&proj[0]);

    //take screenshot here
}

glPopMatrix();

Where xgrid and ygrid represent the subdivisions along the x and y axes.

Nico[/b]
I gave that a try, but the screenshot came out as nothing but the clear color. :frowning:
I tried a method I found in Game Programming Gems 2 (Taking Print Resolution Screen Shots by Alex Vlachos), but there are slight seams along the subdivisions in the x axis.

edit: Whoops, I just messed with your idea some more. I was forgetting to switch back to modelview matrix before drawing for the screenshots… heh. And I Got it to work! Thanks!

I still have slight seams, but this time its not the projection matrix (For some reason if I glReadPixels with the actual client rect window size, it gives me back crazy misaligned garbage… I have to subtract 6 pixels from the width, which in turn doesn’t get the whole screen so the pictures dont line up exactally across the width. Im guessing it has something to do with MFC.)

Use glPixelstorei to set GL_PACK_ALIGNMENT and GL_UNPACK_ALIGNMENT to 1.

Also, to avoid seams, make sure your orginal width and height are multiples of their respective subdivisions.

Nico