There are a number of built-in GLUT objects. There are more in the readings, but here are a few.
void glutWireSphere(GLdouble radius, GLint slices, GLint stacks); void glutSolidSphere(GLdouble radius, GLint slices, GLint stacks); void glutWireCone(GLdouble base, GLdouble height, GLint slices, GLint stacks); void glutWireCube(GLdouble size); void glutWireTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings); void glutWireDodecahedron(void); void glutWireTeapot(GLdouble size);
SilhouetteEdge.py demo.
Cone.py demo
Teapot.py demo
Is there any disadvantage to using these? Why do you think we didn't use glutSolidCube for the color cube?
It's important to remember that the initial coordinate system has the z axis coming out of the screen.
When you T, R, or S, you change the coordinate system for all subsequent operations; that is, you change the interpretation or meaning of vertices. The vertex (2,3,4) means something different as a result.
However, these are affine transformations, which means that lines stay lines and planes stay planes. Therefore, to transform a line, you transform the endpoints and draw the line between the transformed endpoints.
The affine transformation functions are:
We also need to know:
So, one take-home message of this is:
Define your object in a coordinate system that is convenient, then use affine transformations to place your object in the scene.
We'll carefully walk through the code for
the demos/modeling/Blocks.py
demo. We'll spend a good deal of time on the Blocks.py demo.
Then we'll turn to:
Exercise: place two boxes in a scene, one sitting on the ground and the other tilted next to it, as if it just fell off.
For more fun, try to build a snowman.
We'll turn to some more complex examples:
The TW API defines the following for your use
We'll look at their code and documentation in TW.py
Over the last few years, the 307 students have been building up a library of objects. These all need to be recoded in Python, but I've done one:
Next time, we'll look at the math of affine transformations.
Written by Scott D. Anderson
scott.anderson@acm.org

This work is licensed under a Creative Commons
License.