Добрый день!
Не могу понять почему не рисует ось z.Оси x и у рисует.
int main(int argc, char* argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA);
glutInitWindowSize(1200, 800);
glutCreateWindow("OpenGL lesson 5");
glutReshapeFunc(reshape);
glutDisplayFunc(display);
glutKeyboardFunc(processNormalKeys);
glutSpecialFunc(processSpecialKeys);
glutMainLoop();
return 0;
}
void reshape(int w, int h)
{
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-20, 20, -20, 20,-20, 20);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glClearColor(1, 1, 1, 0);
}
void display()
{
float left = -15;
float right = 15;
float bottom = -15;
float top = 15;
float znear =15;
float zfar = -15;
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0, 0.0, 0.0);
glPushMatrix();
glBegin(GL_LINES);
glColor3f(0, 0, 1);//x
glVertex3f(left, 0, 0);
glVertex3f(right, 0, 0);
glColor3f(0, 1, 0);//y
glVertex3f(0, bottom,0);
glVertex3f(0, top,0);
glColor3f(0, 1, 1);//z
glVertex3f(0, 0,znear);
glVertex3f(0, 0,zfar);
glEnd();
glColor3f(1.0, 0.0, 0.0);
glutWireTeapot(5);
glPopMatrix();
glFlush();
glutSwapBuffers();
}