This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: 6.837 Introduction to Computer Graphics Assignment 5: OpenGL and Solid Textures Due Wednesday October 22, 2003 at 11:59pm In this assignment, you will add an interactive preview of the scene and solid textures. For interactive display, you will use the OpenGL API that uses graph- ics hardware for fast rendering of 3D polygons 1 . You will be able to interactively pre-visualize your scene and change the viewpoint, before using ray-tracing for higher-quality rendering. Most of the infrastructure is provided to you, and you will mostly need to add functions that send the appropriate triangle-rendering commands to the API to render or “paint” each kind of Object3D primitive. Finally, you will add new Material effects where the color of the material varies spatially using procedural solid texturing. This will allow you to render checker- board planes and truly satisfy the historical rules of ray-tracing. The two parts of this assignment are mostly independent. 1 OpenGL Rendering In OpenGL, you display primitives by sending commands to the API. The API takes care of the perspective projection and the various other transformations, and also “rasterizes” polygons,. i.e., it draws the appropriate pixels for each polygon. How it does this is the subject of the following series of lectures on the rendering pipeline . In addition, the infrastructure we provide takes care of the user interface and how the mouse controls the camera. Using OpenGL To use OpenGL on Athena, you will first need to obtain access to the OpenGL libraries and header files. To do this, from an Athena prompt, type: add mesa If you are using Windows, then you may need to download the OpenGL libraries yourself from http://www.opengl.org . To add an OpenGL rendering interface to your application, you will use the class GLCanvas provided in glCanvas.h and glCanvas.C . They rely on an updated version of light.C and light.h ; on a new member method, paint , of 1 On some configuration, software emulation might be used, resulting in slower rendering. 1 Object3D ; and on new methods that will be added to your Camera class. Most of the code for these routines is provided. You will need to write the paint() routine for each Object3D subclass to render the primitives within the canvas. To use the GLCanvas as the real-time front-end for your application, you will need to create a GLCanvas object in your main routine and call the following function: glCanvas.initialize(SceneParser *_scene, void (*_renderFunction)(void)); The initialize routine takes two parameters: The first is a pointer to the global scene. The second is the function that will perform the raytracing. The GLCanvas class is set up so that the renderFunction takes no parameters and has a void return type. From within the real-time interface (with the mouse cursor within the frame of the GL display window), you can call the render function by pressing ’r’....
View Full Document
This note was uploaded on 12/14/2011 for the course EECS 6.837 taught by Professor Durand during the Fall '03 term at MIT.
- Fall '03
- Computer Graphics