Review Exercise
¢
In the code glColor3f(0.0, 1.0, 0.0)
Ø
What do the numbers in parentheses represent?
Red, Green, and Blue components of the color
Ø
What does f stand for?
floating point or numbers with
decimals
¢
Write the function that forces previously issued OpenGl command to
begin execution
glFlush() or glFinish()
¢
Blocks of code enclosed by glBegin(mode) and glEnd() are used to draw
in OpenGL.
Provide the
code for mode in order to draw the following items.
Ø
Individual points
GL_POINTS
Ø
Line segments
GL_LINES or GL_LINE_STRIP_ or
GL_LINE_LOOP
Ø
A convex polygon
GL_POLYGON
¢
Write code that will set line width to 2.0
glLineWidth(2.0);
¢
What does the GL in OpenGL stand for?
Graphics library.
¢
OpenGL is referred to as a State Machine. What does this mean?
You can put it into various
states or modes that remain effective until you change
them.
¢
The following code is used in many applications: #include <GL/gl.h>.
What
is the purpose of the brackets (<>)?
Tells compiler to look in the
standard directory for C++.
¢
Code prefaced with # is referred to as what?
Preprocessor Directive
¢
What is the purpose of the glutInit() function?
Initializes glut and processes any command line arguments.
¢
What is the purpose of the glutInitDisplayMode () function?
Specifies whether to use an RGBA or color-index color model. You can also
specify
whether you
want a single or double
buffered window.
¢
What is the purpose of the glutMainLoop (void) function and when is
it called?
The last thing called. All windows that have been created are now displayed.
Event
processing
begins.
¢
By default, the camera is located where?
At the Origin.
¢
By default, the camera is pointing in which direction?
Toward
the negative z axis
¢
Write code, using gluLookAt() that will position the camera on the x
axis, 4 units from the origin, looking toward the origin, with positive y as
the positive direction.
gluLookAt(4.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 1.0, 0.0)
¢
Fill in the blanks with the name of the function being decribed.
Ø
__________________________ sets the
current matrix with a matrix that has 1’s along
the diagonal and 0s elsewhere
glLoadIdentify()
Ø
________________________ moves the
camera to the location specified by the 3
parameters
glTranslate (a,b,c)
Ø
__________________________
multiplies the current matrix by a matrix that stretches,
shrinks, or reflects an object
along the axes.
glScale()
Ø
__________________________
multiplies the current matrix by a matrix that rotates an
object through the speficied angle in a counerclockwise direction
about the ray from the
origin through the point specified by the x, y, and z parameters
glRotate(angle, x, y, z)
Ø
__________________________ defines
a pixel rectangle in the rectangle into which
the final image is mapped. The x,y parameters specify the lower left
corner of the
viewport and the width and height are the size of the viewport
rectangle
glViewport()
Ø
__________________________is used to
specify the desired shading technique.
glShadeModel().
Ø
__________________________initialized
the window size
glutInitWindowSize()
Ø
__________________________initializes
the window position
glutInitWindowPosition()
Ø
The glFrustrum() function takes the
following parameters
Ø
________________left
Ø
_________________right
Ø
________________bottom
Ø
________________top
Ø
________________near
Ø
________________far
¢
What is the difference between a perspective an an orthographic
projection?
A perspective projection presents the object as it appears, with items in
the distance
appearing
smaller. An orthographic projections keeps original dimensions.
¢
Fill in the blanks
Ø
The human eye perceives color when
certain cells in the retina, called _______________
become excited after being struck by photons.
Cone cells or cones
Ø
The A in RGBA stands for
________________________ alpha,
the transparency
Ø
With
________________________________ display mode, OpenGL uses a lookup
table. color-index
Ø
___________________ is the
technique of using combinations of some colors to create
the effect of other colors
dithering
Ø
When primitives are
____________________________ they are converted to a two-dimensional image.
This process involves determining which squares of an integer grid in window
coordinates are occupied by the primitive and then assigning color and other
values to each such square.
Rasterized
Ø
A grid square along with its
associated values of color, z (depth), and texture coordinates is
called a ____________________________
fragment
Ø
What does GLUT stand for?
Graphics Library Utility Toolkit
Ø
What does GLU stand for?
OpenGl Utility Library
Ø
We refer to the OpenGL API. What
does API stand for?
Application Programming
Interface
Ø
OpenGL was originally developed by
___________________________________ (name of company)
Silicon Graphics
Ø
What is accomplished by the
viewing transformation?
Positions and aims the camera.
Ø
What is the purpose of the modeling
transformation?
Manipulates the position and sets
the orientation of a model by moving, rotating, or scaling it.
Ø
What is the purpose of the
projection transformation?
Defines the viewing volumn and
clipping planes.
Ø
Place code between the begin and end
statements below that will draw a polygon with 5 sides. Do not specify a
color
glBegin(GL_POLYGON);
glVertex2f(2.0, 3.0);
glVertex2f(6.0, 3.0);
glVertex2f(6.0, 2.0);
glVertex2f(3.0, 0.0);
glEnd();