Am I doing something glaringly stupid here?
I set up an Ortho2D this way:
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho2d(0.0, 500., 0.0, 500.);
Then do my display this way:
void paint( ){
float matrix[16];
glClear(GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glPushMatrix();
glBegin(GL_LINES);
for( int i = 0; i < 5; i++ ) {
cout << " ****************** " << i << " ********************
";
cout.flush();
glGetFloatv(GL_MODELVIEW_MATRIX, (float*)matrix);
printMatrix(matrix);
glVertex2i(0, 0);
glVertex2i(50, 50);
glTranslatef(10,10,0);
}
glEnd();
glPopMatrix();
glFinish();
}
void printMatrix(float* f) {
for (int i = 0; i < 4; i++) {
cout << " | " << f[i] << " " << f[i+4] << " "
<< f[i+8] << " " << f[i+12] << " |
";
cout.flush();
}
cout << "
";
cout.flush();
}
Gives me the following as output:
****************** 0 ********************
| 1.4013e-45 4.70198e-37 -2.76267e-05 4.70198e-37 |
| -1.59186 4.70198e-37 -1.59186 5.09673e-34 |
| -2.92047e-05 5.09673e-34 -2.74551e-05 1.4013e-45 |
| -2.97713e-05 0 3.99481e-34 -2.76267e-05 |
****************** 1 ********************
| 1.4013e-45 4.70198e-37 -2.76267e-05 4.70198e-37 |
| -1.59186 4.70198e-37 -1.59186 5.09673e-34 |
| -2.92047e-05 5.09673e-34 -2.74551e-05 1.4013e-45 |
| -2.97713e-05 0 3.99481e-34 -2.76267e-05 |
****************** 2 ********************
| 1.4013e-45 4.70198e-37 -2.76267e-05 4.70198e-37 |
| -1.59186 4.70198e-37 -1.59186 5.09673e-34 |
| -2.92047e-05 5.09673e-34 -2.74551e-05 1.4013e-45 |
| -2.97713e-05 0 3.99481e-34 -2.76267e-05 |
****************** 3 ********************
| 1.4013e-45 4.70198e-37 -2.76267e-05 4.70198e-37 |
| -1.59186 4.70198e-37 -1.59186 5.09673e-34 |
| -2.92047e-05 5.09673e-34 -2.74551e-05 1.4013e-45 |
| -2.97713e-05 0 3.99481e-34 -2.76267e-05 |
****************** 4 ********************
| 1.4013e-45 4.70198e-37 -2.76267e-05 4.70198e-37 |
| -1.59186 4.70198e-37 -1.59186 5.09673e-34 |
| -2.92047e-05 5.09673e-34 -2.74551e-05 1.4013e-45 |
| -2.97713e-05 0 3.99481e-34 -2.76267e-05 |
All I’m seeing is one line, and the printouts of the Modelview are all the same. Is it something I’m doing, or does glTransaltef not get along well with Ortho2D?