CS312 Lab 6: Transparencies
- Copy the demo executable fog from ~eeaton/public/cs312/handouts/gldemo
to your own directory. Run.
- Copy the demo executable cube-sphere from ~eeaton/public/cs312/handouts/
to your own directory. Run
- Copy the demo executable cube-alpha and the
texture glass.ppm
from ~eeaton/public/cs312/handouts/
to your own directory. Run.
- Write your own versions of cube-sphere and cube-alpha.
- Use glutSolidSphere and glutSolidCube for cube-sphere.
- Transparent textures are obtained using the
fact that OpenGL multiplies texture color with light/material color.
Thus, applying texture as usual, and specifying a translucent white
material will make your texture transparent. The easiest way is to
simply call glColor4f(1.0,
1.0,
1.0, 0.5); somewhere in init() and then call glEnable(GL_COLOR_MATERIAL); Enabling
this
automatically specifies a material that comforms to your current
drawing color, specified by glColor*
- Remember to request the GLUT_ALPHA buffer
- Remember to turn on blending
- You may need to turn off the depth test for
blending to work properly (depends on your drawing order)
- Experiment with source and destination alphas
to get the desired effects.
- Submit your lab as a tarball that extracts to its own directory
to ~eeaton/submit/cs312/username/.