|
A Quick OpenGL Tutorial else glClear(GL_COLOR_BUFFER_BIT); /* draw the floor */ glBegin(GL_QUADS); glColor3f(0.2f, 0.2f, 0.2f); glVertex3f(-100.0, 0.0, –100.0); glColor3f(0.4f, 0.4f, 0.4f); glVertex3f(-100.0, 0.0, 100.0); glColor3f(0.6f, 0.6f, 0.6f); glVertex3f(100.0, 0.0, 100.0); glColor3f(0.8f, 0.8f, 0.8f); glVertex3f(100.0, 0.0, –100.0); glEnd(); /* draw 12 cubes with different colors */ drawcube(75, 57, 2); drawcube(-65, –12, 3); drawcube(50, –50, 1); drawcube(-56, 17, 2); drawcube(67, 12, 3); drawcube(-87, 32, 1); drawcube(-26, 75, 2); drawcube(57, 82, 3); drawcube(-3, 12, 1); drawcube(46, 35, 2); drawcube(37, –2, 3); glutSwapBuffers(); } void keyboard(unsigned char key, int x, int y) { /* This time the controls are: "a": move left "d": move right "w": move forward "s": move back "t": toggle depth-testing */ switch (key) { case 'a': case 'A': glTranslatef(5.0, 0.0, 0.0); break; case 'd': case 'D': glTranslatef(-5.0, 0.0, 0.0); break; case 'w': case 'W': glTranslatef(0.0, 0.0, 5.0); ...» | Код для вставки книги в блог HTML
phpBB
текст
|
|