

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
OpenGL common function in 2d and 3d
Typology: Lecture notes
1 / 2
This page cannot be seen from the preview
Don't miss anything!


In this lab we will take a look at drawing 3-D objects in OpenGL.
Task 1: Begin a new C++ Win32 Console Application Project in Visual Studio .NET called Lab4GlutPolyhedra , setting the root folder to a Graphics folder on your student storage. Paste in the code from the Lab4GlutPolyhedra.cpp file on the course website.
Task 2: Examine the application code. The important functions to take a look at in this application are glFrustum , gluLookAt and the 3-D shape drawing functions (only some of these are used in the sample application):
Build this application now and run it - it should look like this:
Task 3: Build a new application that displays a 3-D wireframe teapot and rotates it continuously around the y-axis. It should look like the application shown below:
Task 4: Add a mouse button handler so that when you press the left mouse button the animation starts and stops.
Task 5: Add a keyboard handler so that pressing the ‘a’ key zooms in on the teapot and the ‘z’ key zooms out from the teapot. HINT: The key to this will be changing the parameters passes to the gluLookAt function. To get an idea of how this application should behave, the finished version is available for download on the labs webpage.