2
* Test Z values of glBitmap.
21
PrintString(const char *s)
24
glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s);
33
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
35
glMatrixMode(GL_PROJECTION);
37
glOrtho(-3.0, 3.0, -3.0, 3.0, -2.0, 2.0);
39
glMatrixMode(GL_MODELVIEW);
43
glRasterPos2f(-2.0, 2.6);
44
PrintString("Z = -1.0");
45
glRasterPos2f(-0.5, 2.6);
46
PrintString("Z = 0.0");
47
glRasterPos2f(1.0, 2.6);
48
PrintString("Z = 1.0");
50
glColor3f(0, 0.4, 0.6);
52
glVertex3f(-2.0, -2.5, -1);
53
glVertex3f(-1.0, -2.5, -1);
54
glVertex3f(-1.0, 2.5, -1);
55
glVertex3f(-2.0, 2.5, -1);
57
glVertex3f(-0.5, -2.5, 0);
58
glVertex3f(0.5, -2.5, 0);
59
glVertex3f(0.5, 2.5, 0);
60
glVertex3f(-0.5, 2.5, 0);
62
glVertex3f(1.0, -2.5, 1);
63
glVertex3f(2.0, -2.5, 1);
64
glVertex3f(2.0, 2.5, 1);
65
glVertex3f(1.0, 2.5, 1);
70
glRasterPos3f(-2.0, -1, -1.0);
71
PrintString("This is a bitmap string drawn at z = -1.0");
73
glRasterPos3f(-2.0, 0, 0.0);
74
PrintString("This is a bitmap string drawn at z = 0.0");
76
glRasterPos3f(-2.0, 1, 1.0);
77
PrintString("This is a bitmap string drawn at z = 1.0");
79
glRasterPos3f(-1.5, -2.8, 0.0);
80
PrintString("GL_DEPTH_FUNC = GL_LEQUAL");
87
Reshape(int width, int height)
89
glViewport(0, 0, width, height);
94
Key(unsigned char key, int x, int y)
97
glutDestroyWindow(Win);
107
glClearColor(0.25, 0.25, 0.25, 0.0);
108
glDepthFunc(GL_LEQUAL);
109
glEnable(GL_DEPTH_TEST);
114
main(int argc, char *argv[])
116
glutInitWindowSize(400, 400);
117
glutInit(&argc, argv);
118
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
119
Win = glutCreateWindow(argv[0]);
121
glutReshapeFunc(Reshape);
122
glutKeyboardFunc(Key);
123
glutDisplayFunc(Display);