o p e n g l - s a m p l e s

here are the some opengl samples i have helped to develop as a teaching assistant for the graphics class at duke university, and for teaching the c++/visualization courses at adrenaline. source code and win32 executables open to download and use. nearly every sample requires GLUT, you can download it from here. my request is if you plan to use the code in some near-verbatim fashion, please credit the contributing authors to each. thank you, enjoy!

contact: gewang@cs.princeton.edu


clipping planes demonstrates using arbitrary clipping planes in animations. shows making and moving clipping planes in real-time.

source
win32 executable
[full size image]



globe demonstrates load and mapping a simple texture onto a glu sphere along with lighting. note: opengl requires all textures to have dimensions that are powers of 2 (plus optional compensation for a border)

source
win32 executable + texture image
[full size image]
  



mirror shows how to implement mirrors with the stencil, depth, and color buffers. conditions are simplified in assuming mirror is on the xy plane. other implementation details for generic case.

source
win32 executable
[full size image]



starfield flies forwards or backwards through colorful rocks. control by holding down L or R mouse button. shows light attenuation, and a neat and efficient fading technique.

source
win32 executable
[full size image]



shadow uses the z-buffer algorithm for generating shadows.

source
win32 executable
[full size image]



lorenz3d (2000) visualizes the lorenz attractor in real-time 3d. in addition to seeing the numerical solution traced out at any rotation, you can also see the curve in 1st person in roller coaster view.

see the lorend3d page
[full size image]



xform is a simple illustration of hierarchical modeling in opengl.

source
win32 executable
[full size image]


- ge wang -

home | projects | email me