PDA

View Full Version : Enlarging areas of the screen (for huge screenshots) ?

Kiamo
10-27-2004, 11:11 AM
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?

-NiCo-
10-27-2004, 03:03 PM
Try this:

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

glMatrixMode(GL_PROJECTION);
glPushMatrix();

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

//take screenshot here
}

glPopMatrix();Where xgrid and ygrid represent the subdivisions along the x and y axes.

Nico

Kiamo
10-28-2004, 05:20 AM
Originally posted by -NiCo-:
Try this:

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

glMatrixMode(GL_PROJECTION);
glPushMatrix();

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

//take screenshot here
}

glPopMatrix();Where xgrid and ygrid represent the subdivisions along the x and y axes.

NicoI gave that a try, but the screenshot came out as nothing but the clear color. :(
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.)

-NiCo-
10-28-2004, 01:30 PM
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