




p et P pour activer/désactiver la fonctionnalité
#include <windows.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glaux.h>
#include <stdio.h>
#include <stdlib.h>
static int proj = 0 ;
static int ww ;
static int hh ;
void CALLBACK display(void) {
glClear(GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
if ( proj )
glOrtho(-10.0,10.0,-10.0,10.0,-10.0,10.0);
else
glOrtho(-10.0,10.0,-10.0*(double) hh/ww,10.0*(double) hh/ww,-10.0,10.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glPushMatrix();
auxWireSphere(7.0) ;
glPopMatrix();
glFlush();
}
void myinit (void) {
glClearColor(0.0,0.0,0.0,1.0);
}
void CALLBACK myReshape(int w,int h) {
glViewport(0,0,w,h);
ww = w ;
hh = h ;
}
void CALLBACK keyP(void) {
proj++;
proj %= 2;
}
void CALLBACK keyp(void) {
proj++;
proj %= 2;
}
void main(void) {
auxInitDisplayMode(AUX_SINGLE|AUX_RGB);
auxInitPosition(0,0,200,200);
auxInitWindow("Reshape homothétique");
myinit();
auxKeyFunc(AUX_P,keyP);
auxKeyFunc(AUX_p,keyp);
auxReshapeFunc(myReshape);
auxMainLoop(display);
}
RETOUR