1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
//windowOps.cpp
#include <GL/glut.h>
#include "windowOps.h"
#include "keyOps.h"
#include "rendering.h"
void reshape( int width, int height ) {
glViewport(0, 0, (GLsizei)width, (GLsizei)height );
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(60, (GLfloat)width / (GLfloat)height, 1.0, 100.0 );
glMatrixMode(GL_MODELVIEW);
}
void display( void ) {
keyOperations();
glClearColor (0.0,0.0,0.0,1.0);
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glTranslatef( 0.0f, 0.0f, -5.0f );
gluLookAt ( 3.0, 2.0, 2.5, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
renderPrimitive();
glutSwapBuffers();
}
|