# Staging Areabattis.net Each OpenGL primitive (well, each OpenGL GLUT primitive) can be drawn either as a solid (filled) shape or as a wireframe shape. The two method calls are identical in parameters by differ in their names (as listed below). Each of the methods listed below is a method of the GLUT object, so a primitive would be drawn as a method call of that object:

`glut.glutSolidCube(1.0);` ```glutSolidCube(float sideLength) glutWireCube(float sideLength)``` Usually a cube is drawn with unit (1) side length and then scaled to the size desired. This make the cube ideal as the “base shape” for any rectangular shape (since the scaling can be different along each of the x-, y-, and z-axes). ```glutSolidSphere(float radius, int slices, int stacks) glutWireSphere(float radius, int slices, int stacks)``` Spheres are not actually spherical, they are approximated with polyhedrons. The slices parameter defines how many slices (like orange wedges — the longitude lines) the sphere is broken into, while stacks defines how many latitude divisions (rings) the sphere is divided into. Obviously more slices and stacks results in a polyhedron more closely approximating a sphere… but also in a larger number of polygons and thus greater load on the computer. (And, remember, the number of polygons is equal to slices × stacks: 10 slices and 10 stacks gets you 100 polygons.) ```glutSolidCylinder(float radius, float length, int slices, int stacks) glutWireCylinder(float radius, float length, int slices, int stacks)``` The cylinder is (surprisingly, at least to this author) drawn along the z-axis — that is, with the eye staring down the barrel of it from a “normal” default viewpoint). It too is divided into slices and stacks, and in the same manner. Often one needs only a single stack (thereby allowing for the maximizing of slices and thus cylindricality). ```glutSolidCone(float radius, float height, int slices, int stacks) glutWireCone(float radius, float height, int slices, int stacks)``` The cone too is drawn along the z-axis (like the cylinder). It too is broken into slices and stacks. ```glutSolidTorus(float innerRadius, float outerRadius, int sides, int rings) glutWireTorus(float innerRadius, float outerRadius, int sides, int rings)``` The torus has two radii because the inner radius is the radius of the rings circling the “donut”, while the outer radius is the radius of the donut itself. The number of sides refers to the number of sides on the inner radius, while the number of rings is the number of inner radius-sized rings. ```glutSolidTeapot(float scale) glutWireTeapot(float scale)``` It pretty much does what it says. Why a teapot? This is no ordinary teapot: this is the Utah Teapot. Also available: ```glutSolidIcosahedron() glutWireIcosahedron()   glutSolidOctahedron() glutWireOctahedron()   glutSolidTetrahedron() glutWireTetrahedron()   glutSolidDodecahedron() glutWireDodecahedron()``` These all do pretty much what they sound like.

January 5th, 2011

Posted In: Handouts

Tags: , , , 