[home]
[research]
[curriculum vitae]
[OpenGL Examples]
[Light Field Archive]
[contact]

OpenGL Examples

This website provides a number of simple OpenGL programs that have proven extremely useful for a lot of people throughout the last 10 years. Feel free to use them! Foremost, the SimpleGLUT and FrameBufferObject classes are most intuitive and indispensable implementations of functionality required by most OpenGL programs.




Simple GLUT - it could not be easier!

A simple example of how to use GLUT for creating OpenGL windows and rendering a simple teapot. Navigation is provided using the mouse: rotation, panning and zooming.

Download source and executable simpleGLUT.zip.



Simple, yet complete Framebuffer Object Example

Everyone loves it - everyone needs it: The FramebufferObject, OpenGL's offline buffer at it's best.

This example provides a standalone class that encapulates OpenGL's Framebuffer Object. You can easily integrate it in your own code by adding the FramebufferObject.h and .cpp files. The interface is straightforward and based on Mark Harris' RenderTexture class. Supported are color attachments with multiple render targets (MRT), depth attachments, even stencil attachments are working now. It has also been tested with LINUX and should work with few modifications.

Download source and executable TestFramebufferObject.zip.



Simple GLUT with textures - make it look pretty!

The simple example, extended by a texture loader. The image is loaded with OpenCV, which supports a variety of different image formats (bmp, png, jpg etc) and then mapped onto several rectangles.

Download source and executable simpleGLUT-Texturing.zip.



OpenCV-based camera grabber with OpenGL visualization - just a few lines of code!

Always useful: being able to grab images from cameras [USB, FireWire and more] and visualizing them with OpenGL. The camera grabber uses OpenCV, so it runs under Windows and LINUX. You need to download [and compile] OpenCV, it is not included!

Download source and executable simpleGLUT-CvCamera.zip.



Simple Cg Fragment Shader - as shown in CS 312, Introduction to Computer Graphics

A very basic example of a fragment shader performing gamma mapping on a 2D image. The actual shader is only two lines of code!

Tested on Windows, should work on LINUX as well, let me know if you have trouble compiling it.

Download source and executable CS314-CgExample-FragmentShader.zip.



Simple Cg Vertex Shader - as shown in CS 312, Introduction to Computer Graphics

A very basic example of a vertex shader performing standard OpenGL pipeline transformations and Gouraud shading. Additionally, the vertices can be moved along the normal directions with user input. This operation is one line of non-standard code in the vertex shader.

Tested on Windows, should work on LINUX as well, let me know if you have trouble compiling it.

Download source and executable CS314-CgExample-VertexShader.zip.



Phong Shading on the GPU - Simple Combination of Cg Vertex and Fragment Shaders - as shown in CS 312, Introduction to Computer Graphics

A very basic example of combining vertex and fragment shaders. Instead of performing standard Gouraud shading (per-vertex lighting), the vertex shader performs all transformations, and the fragment shader performs the lighting per-pixel!

Tested on Windows, should work on LINUX as well, let me know if you have trouble compiling it.

Download source and executable CS314-CgExample-VertexFragmentShader.zip.



Interactive Real-Time GPU implementation of the Heat Equation - tons of fun! (also shown in CS 314)

Simple physical simulation on the GPU. Might help you getting started with your own GPGPU application. Includes floating point FBOs. Just draw heat in 2D with your mouse! The heat equation is a simple partial differential equation (PDE) and in this case discretized with central finite differences in space and Forward Euler in time (one line of Cg code!).

Download source and executable 2DHeatSimulation.zip.