CUGL
2.0
|
Functions | |
double | cugl::radians (double angle) |
double | cugl::degrees (double angle) |
double | cugl::sqr (double x) |
unsigned int | cugl::randInt (unsigned int max) |
int | cugl::randSym (unsigned int max) |
double | cugl::randReal () |
void | cugl::triStripNormals (Point points[], Vector normals[], int numPoints, bool neg=false) |
void | cugl::revolve (int numSteps, GLfloat coor[][2], int numSlices, bool drawNormals=false) |
void | cugl::lookAt (Point eye) |
void | cugl::lookAt (Point eye, Point model) |
void | cugl::lookAt (Point eye, Point model, Vector up) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Return a random integer in [0, max).
Definition at line 2335 of file cugl.h.
Referenced by cugl::randReal(), and cugl::randSym().
|
inline |
Return a random double in [0, 1).
Definition at line 2356 of file cugl.h.
References cugl::randInt().
|
inline |
Return a random integer in [-max, max].
Definition at line 2350 of file cugl.h.
References cugl::randInt().
void cugl::revolve | ( | int | numSteps, |
GLfloat | coor[][2], | ||
int | numSlices, | ||
bool | drawNormals = false |
||
) |
Constructs a surface of revolution. Constructs and renders a surface of revolution obtained by rotating a curve about the Y axis.
numSteps | is the number of points in the array coor |
coor | is the 2D coordinates of points of the profile |
numSlices | is the number of pie-shaped slices used to render the surface. |
drawNormals | determines whether normals are generated. By default, normals are not generated. |
For example, if numSlices
= 20, points will be constructed at 360/20 = 18 degree intervals.
This function constructs an array of points in 3D space and then issues calls to glVertex()
. If drawNormals
is true, it also issues calls to glNormal()
. The effect of these calls is to define a 3D mesh. It is up to the caller to set the OpenGL state for rendering: this includes setting material properties and defining rules for polygon shading.
The normals generated by revolve()
are obtained by averaging the normals of the polygons that meet at each vertex. Consequently, if GL_SMOOTH
shading is used and enough points are specified, the object should look fairly smooth.
Revolute
, which provides more functionality and is more efficient.
|
inline |
void cugl::triStripNormals | ( | Point | points[], |
Vector | normals[], | ||
int | numPoints, | ||
bool | neg = false |
||
) |
Construct normals for OpenGL triangle strips. Given a set of vertexes definining a triangle strip in OpenGL format, this functions constructs a normal corresponding to each vertex.
points | is an array of points giving the vertex coordinates. |
normals | is an array of vectors in which the vertex normals will be stored. |
numPoints | is the number of vertexes provided and the number of normals that will be calculated. |
neg | specifies negated normals, if true. The default is false. |