next up previous contents
Next: 5.19.2 Refinements Up: 5.19 Gradual Cutaway Views Previous: 5.19 Gradual Cutaway Views

5.19.1 Steps to Generating a Cutaway Shell

  1. Draw the object internals with depth buffering.
  2. Enable and configure a 1 dimensional texture ramp; use GL_ALPHA as the format.
  3. Enable and configure texture coordinate generation for the s component; use eye linear, and set the s eye plane to map -z over the range of the object shell cutaway from 0 to 1.
  4. Enable blending, and set the blend mode: source is GL_SRC_ALPHA, destination is GL_ONE_MINUS_SRC_ALPHA.
  5. Render the shell of the object in depth order; most distant objects first. For convex shells, this could be done using face culling.
  6. Load a different texture ramp in the 1D texture map.
  7. Render the shell edges; you can do this by re-rendering the shell after call glPolygonMode() with the mode set to GL_LINE.

If you want to render the shell edges, you'll need to use polygon offset, or some other method, such as using the stencil buffer, to avoid z fighting. A reasonable setting to try would be glPolygonOffset-1.f, -1.f(-1.f, -1.f).