#include "windows.h" #include <GL/gl.h> #include <GL/glu.h> #include <GL/glaux.h> #include <stdio.h> #include <stdlib.h> static float rotx = 0.0f ; static float roty = 0.0f ; static float rotz = 0.0f ; void myinit(void) { glShadeModel(GL_FLAT); } void CALLBACK myReshape(int w, int h) { glViewport(0,0,w,h); /*(4)*/ glMatrixMode(GL_PROJECTION); /*(3)*/ glLoadIdentity(); /*(3)*/ glFrustum(-1.,1.,-1.,1.,1.5,20.);/*(3)*/ glMatrixMode(GL_MODELVIEW); /*(2-1)*/ } void CALLBACK display(void) { glClear(GL_COLOR_BUFFER_BIT); glColor3f(1.0,1.0,1.0); glLoadIdentity(); /*(2)*/ glTranslatef(0.0,0.0,-5.0); /*(2)*/ glRotatef(rotx,1.0f,0.0f,0.0f); /*(2)*/ glRotatef(roty,0.0f,1.0f,0.0f); /*(2)*/ glRotatef(rotz,0.0f,0.0f,1.0f); /*(2)*/ glScalef(1.0,2.0,3.0); /*(1)*/ auxWireCube(1.0); /*(1)*/ glFlush(); } void CALLBACK auxX(void) { rotx += 2 ; } void CALLBACK auxx(void) { rotx -= 2 ; } void CALLBACK auxY(void) { roty += 2 ; } void CALLBACK auxy(void) { roty -= 2 ; } void CALLBACK auxZ(void) { rotz += 2 ; } void CALLBACK auxz(void) { rotz -= 2 ; } void main() { auxInitDisplayMode(AUX_SINGLE|AUX_RGB); auxInitPosition(0,0,200,200); auxInitWindow("Visualisation"); myinit(); auxKeyFunc(AUX_X,auxX) ; auxKeyFunc(AUX_x,auxx) ; auxKeyFunc(AUX_Y,auxY) ; auxKeyFunc(AUX_y,auxy) ; auxKeyFunc(AUX_Z,auxZ) ; auxKeyFunc(AUX_z,auxz) ; auxReshapeFunc(myReshape); auxMainLoop(display); }
RETOUR