nuclear@1: #include nuclear@1: #include nuclear@1: #include nuclear@1: #include nuclear@1: #include "sanegl.h" nuclear@1: nuclear@1: void disp(void); nuclear@1: void reshape(int x, int y); nuclear@1: void keyb(unsigned char key, int x, int y); nuclear@1: nuclear@1: int main(int argc, char **argv) nuclear@1: { nuclear@1: glutInit(&argc, argv); nuclear@1: glutInitWindowSize(960, 640); nuclear@1: glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE); nuclear@1: glutCreateWindow("test"); nuclear@1: nuclear@1: glutDisplayFunc(disp); nuclear@1: glutIdleFunc(glutPostRedisplay); nuclear@1: glutReshapeFunc(reshape); nuclear@1: glutKeyboardFunc(keyb); nuclear@1: nuclear@1: glutMainLoop(); nuclear@1: return 0; nuclear@1: } nuclear@1: nuclear@1: void disp(void) nuclear@1: { nuclear@1: glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); nuclear@1: nuclear@1: glMatrixMode(GL_MODELVIEW); nuclear@1: glLoadIdentity(); nuclear@1: glTranslatef(0, 0, -8); nuclear@1: nuclear@1: glBegin(GL_QUADS); nuclear@1: glColor3f(1, 0, 0); nuclear@1: glVertex3f(-1, -1, 0); nuclear@1: glColor3f(0, 1, 0); nuclear@1: glVertex3f(1, -1, 0); nuclear@1: glColor3f(0, 0, 1); nuclear@1: glVertex3f(1, 1, 0); nuclear@1: glColor3f(1, 1, 0); nuclear@1: glVertex3f(-1, 1, 0); nuclear@1: glEnd(); nuclear@1: nuclear@1: glutSwapBuffers(); nuclear@1: } nuclear@1: nuclear@1: void reshape(int x, int y) nuclear@1: { nuclear@1: glViewport(0, 0, x, y); nuclear@1: nuclear@1: glMatrixMode(GL_PROJECTION); nuclear@1: glLoadIdentity(); nuclear@1: gluPerspective(45.0, (float)x / (float)y, 1.0, 1000.0); nuclear@1: } nuclear@1: nuclear@1: void keyb(unsigned char key, int x, int y) nuclear@1: { nuclear@1: switch(key) { nuclear@1: case 27: nuclear@1: exit(0); nuclear@1: nuclear@1: default: nuclear@1: break; nuclear@1: } nuclear@1: }