void draw_selection_triangles(void)
{
int face, square, vertex, triangle_count = 1;
GLint viewport[4];
glColor4f(0.0, 0.0, 0.0, 0.0);
glInitNames();
glPushName(0);
for(face = 0; face < 6; face++)
{
for(square = 0; square < 12; square++)
{
glPushMatrix();
glLoadName(triangle_count);
glBegin(GL_TRIANGLES);
for(vertex = 0; vertex < 3; vertex++)
{
glVertex3f(selection_triangles[face][square][vertex][0],
selection_triangles[face][square][vertex][1],
selection_triangles[face][square][vertex][2]);
}
glEnd();
glPopMatrix();
triangle_count++;
}
}
//now add the 2 scramble bitmap selection triangles.
//first change the viewport/projection so the triangles are drawn properly.
glLoadIdentity();
gluLookAt(camera.get_xposition(), camera.get_yposition(), camera.get_zposition(),
0.0, 0.0, 0.0,
camera.get_xupvector(), camera.get_yupvector(), camera.get_zupvector());
glGetIntegerv(GL_VIEWPORT, viewport);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
gluOrtho2D(0.0, (GLfloat) viewport[2], 0.0, (GLfloat) viewport[3]);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
//glLoadIdentity();
glLoadName(triangle_count);
glBegin(GL_TRIANGLES);
glVertex2f(10.0, 10.0);
glVertex2f(74.0, 10.0);
glVertex2f(74.0, 42.0);
glEnd();
glEnd();
glPopMatrix();
triangle_count++;
glPushMatrix();
//glColor3f(0.0, 1.0, 0.0);
glLoadName(triangle_count);
glBegin(GL_TRIANGLES);
glVertex2f(10.0, 10.0);
glVertex2f(74.0, 42.0);
glVertex2f(10.0, 42.0);
glEnd();
glEnd();
//glMatrixMode(GL_PROJECTION);
glPopMatrix();
// Restore the matrices
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
}