Graphics Reference
In-Depth Information
2. In this chapter, we claimed that it was easy to create the inverse of any
transformation that is built with only rotation, scaling, and translation.
Verify this symbolically and use the OpenGL matrix operations to verify
it numerically.
3. When we use flat shading for a graphic object, we usually set the color
before we define the first vertex. In principle, though, we could set a
separate color for each vertex. Try this, creating a graphics object and
calling glColor3f(...) with a different color before each vertex. What
conclusions can you draw about when the color value is set for an
object? For example, is it set the last time glColor3f is called? The first
time? Compare your results with others to see if this is consistent across
OpenGL systems.
4. The way the colors in Figure 1.7 are interpolated suggests that the quad
is actually drawn as two triangles. First, verify this for your own OpenGL
system, because your system may implement quads differently from
ours. Second, extend this by adding more vertices in different colors to
create polygons by extending the quad, and see if you can identify the
way the polygon is implemented. (Our systems seem to implement poly-
gons as triangle fans.)
5. Experiment with non-convex polygons by defining such a polygon with
color or lighting information at each pixel and seeing what your OpenGL
system actually draws. Carefully describe what you see, and develop an
explanation for it.
6. While polygons are defined to be planar, you can readily give OpenGL
a set of non-planar vertices within a GL_QUADS or GL_POLYGON primitive.
Experiment with what happens when you give a set of non-planar ver-
tices to a quad or a polygon, and discuss why your results are plausible.
7. Experiment with z -ighting by drawing two polygons that meet at a very
shallow angle, as shown in Figure 1.10. When you get an example of
this problem, look at the depth of your projection's viewing volume, and
adjust its front and back planes to make the depth as small as possible.
Does this reduce the z -ighting problem? Does it eliminate the problem?
8. Create a model with vertices, vertex colors, and normals and store it using
vertex arrays. Display it without shading, using the vertex colors, with the
glDrawElements( ) technique instead of the usual glBegin( )-glEnd( )
approach. Then change the model to use a single color and the normals
and use smooth shading to display it.
Search WWH ::




Custom Search