Help with strange code block

Just started working with OpenGL (legacy 1.5) and am working to port an existing application to mobile. While going through the code, I found the following block:


  /* Place raster position in lower left corner. */
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glMatrixMode(GL_MODELVIEW);
    glPushMatrix();
    glLoadIdentity();
    glRasterPos2f(-1, -1);
    glPopMatrix();

I see that the first two lines work to set the projection matrix back to an identity matrix, pretty easy. The five lines after that, though, have me scratching my head.

I see that the code works with the modelview matrix, but from my (admittedly new and shallow) understanding of pushing and popping matrices from the stack, the code makes a copy of the original matrix, overwrites it with new data, and then reloads the unmodified copy. This seems like wasted effort as it doesn’t accomplish anything. Is this the case?

[QUOTE=PityOnU;1284041]
I see that the code works with the modelview matrix, but from my (admittedly new and shallow) understanding of pushing and popping matrices from the stack, the code makes a copy of the original matrix, overwrites it with new data, and then reloads the unmodified copy. This seems like wasted effort as it doesn’t accomplish anything. Is this the case?[/QUOTE]
The code does what the comment says. The intent isn’t to permanently modify the matrices (although it should be pushing and popping the projection matrix as well as the model-view matrix), it’s to set the raster position to the lower-left corner of the viewport. In order to do that, it has to reset the matrices so that (-1,-1) maps to the lower-left corner of the viewport.