Instructor: Govindarajan Srimathveeravalli
Home Course Schedule and Materials Resources Source Code Anno/net/wings/info/www/courses/sp07/mae/574-410 uncements Staff and Contact
|
|
Sample programs for Class 1 A collection of programs that show the basic way to setup a GLUT window that will support OpenGL drawings. Demonstrate use of key GLUT functions such as glutReshape and glutDisplayFunc etc. 1. Change the window size, what happens to the square ? Why ? 1. Alter the values provided in glOrtho() command and see what it affects in the output 1. Add a second polygon in the denoted area in the display
function. Does it rotate ? 1. What does the command glutSwapBuffers() do ? |
|
|
Sample programs for Class 2 Three programs demonstrate drawing of basic 2D primitives (points, lines and polygons) using OpenGL. A demonstration of GLUT for integrating Mouse and Keyboard is also included. Try the following in given code. 1. Why do we use glVertex3f instead of say
glVertex3i ? 1. Uncomment the different codes in the init
function to alter the world view. How do the mouse clicks values
vary accordingly ? 1. scale the objects to some random value, use the rand() function used for the color code to achieve this. |
|
|
Sample programs for Class 4 A program to demonstrate the effect of viewport - window mapping in 2D and scaling operations that need to be performed on mouse click values. 1. Relocate the "origin" of the world wrt to the window |
|
|
Sample programs for Class 5 Programs to demonstrate projection and transformation basics within OpenGL. The "solar system" code demonstrates how perspective and clipping operations work within OGL and the effect viewports have on the appearance of the final image. The robot code demonstrates how push-pop functions can be used in sequence to bring about complex movements and reuse objects. 1. Why does Jupiter seem to move slower than the rest ? Is there
any problem with the transformations set up ? 1. Note the use of translation to the origin and back when
performing certain rotation operations. Why are they used so ? |
|
|
Sample programs for Class 6 and 7 This code here demonstrates the impact of adding light(s) to a
scene, effect shading has on the appearance of objects and the
interaction between various parts of light of and the material added
onto the object. This also demonstrates the effect of specular
material property on final appearance, the use of glPush/PopAttrib
and animation of light sources. 1. Disable the depth buffer and see what happens to the spheres.
Why does this happen? Look at the code for clues with order of
rendering. |
|
|
Sample programs for Class 8 and 9 These programs demonstrate framebuffer and pixel related operations in OGL. Specifically it shows the use of blending operations and texturing. 1. Change the fog effect such that everything is set
to the background clear color. How do the objects look like with
respect to the background now? 1. Play around with the clamp, repeat,
decal/replace/modulate parameters of the texture. 1. Note that lighting has been disabled and yet the
scene renders correctly, notice that texture mode has been set to
DECAL 1. Notice how lighting is disabled for the textured background, yet there seems to be an illumination effect. Would enabling the spotlight for the background make any difference? Support material, TGA reader (.h and .cpp) and images (wall and light). |
|
|
Sample programs for Class 10 - 12 Source code to demonstrate how to use vertex arrays and display lists in OpenGl. The code also provides an adaptation of Paul Bourke's Delaunay triangulation algorithm. 1. Try reading in multiple STL objects, you will need to maintain
a separate stlMesh for every one of them. 1. The surface does not have any normals defined. Try enabling GL
Auto normals and GL normalize is there significant difference in the
appearance of the surface? 1. Feed the point values from the "decimation" routine to the
algorithm to render. |
|
Supplement programs for 10-12 The standard template library provides a convenient way to store geometric information for graphic applications. This code can be used with the supplemental slides (class 12) to get an understanding on the workings of STL. |
|
|
|
Sample programs for Class 14 and 15 Parametric curves are a very useful and powerful way of representing complex surfaces or approximating difficult to model objects. Following code demonstrates the use of Bezier's and NURBS for doing simple curves and surfaces. 1. Play around with the curve, we know that since the curves are Bezier, they will always pass through the start and end. See if other properties of Bezier curves (convexity, linearity etc.) can be simulated using a good choice of points.
|
|
|
Sample programs for Class 16 - 19 This code gives a quick demonstration of two things, collision detection (through ray-plane intersection and subsequent point in polygon testing) and giving simple, but dynamically accurate physics response. All objects move under two forces, gravity and a air friction - dissipative force. Collisions are almost elastic (direction vectors are not completely preserved).1. Obviously, the collision detection is not fool proof. After a
number of iterations, it fails, and the balls slip through the
plane. How to fix this? The code gives a simple demonstration of using mass-damper systems for simulating particle physics. The implementation follows Baraff's notes, and provides a simple object oriented structure for the simulation system.
|