X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;ds=sidebyside;f=scene.c;h=7e72ae66e4dc340802a0567e44fb20a7bd43ed04;hb=ef6b009c8781673f3e353d47ae270a9f712bd4bf;hp=5c9b14d0ebd71ba80b81871ea8fab7521eebbd88;hpb=7557493a58d7ab3972efa6933f47b3fbae3d4b2c;p=atyndall%2Fcits2231.git diff --git a/scene.c b/scene.c index 5c9b14d..7e72ae6 100644 --- a/scene.c +++ b/scene.c @@ -464,13 +464,18 @@ void makeMenu() { * @param height New height */ void windowReshape(int width, int height) { - glViewport(0, 0, (GLsizei)width, (GLsizei)height); + /*glViewport(0, 0, (GLsizei)width, (GLsizei)height); printf("Width: %d, height: %d\n", width, height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); - gluPerspective( (500* 60) / width, 1, 0.1, 1000.0); + gluPerspective( 60 * ((GLfloat)height/(GLfloat)width), (GLfloat)width/(GLfloat)height, 0.1, 1000.0); glMatrixMode(GL_MODELVIEW); + GLdouble near = 0.1; + GLdouble far = 1000.0; + GLdouble a = (GLfloat)height/(GLfloat)width; + GLdouble fov = 60; + glFrustum( -a*near*tan(fov/2), a*near*tan(fov/2), -a*near*tan(fov/2), a*near*tan(fov/2), near, far )*/ } /** @@ -536,5 +541,11 @@ int main(int argc, char **argv) { glutMouseFunc(mouse); makeMenu(); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective( 60, 1, 0.1, 1000.0); + glMatrixMode(GL_MODELVIEW); + glutMainLoop(); }