Skip to content

OpenGL and GLSL Demo

Last updated on 2005-11-14

Found some time to play with [GLSL](http://www.opengl.org/documentation/oglsl.html) Extension. I started with a simple Cube Demo from [NeHe](http://nehe.gamedev.net/) using [SDL](http://www.libsdl.org/index.php) for the user interface programming. Then i added [GLEW]( http://glew.sourceforge.net/) as the GLSL extension wrapper. The Shader Programs are taken from Linux Magazin Article. Currently no own ideas 🙂 First i had to refresh my OpenGL basics. So i added some switches to trigger Alpha Blending and different textures.

When running the demo you press following keys to trigger different effects:

* ‘l’ to toggle Light
* ‘b’ to enable Alpha Blend
* ‘f’ to step through NEAREST, LINEAR and MIPMAP textures
* ‘s’ toggle current Shader Programm
* ‘n’ switch to different Shader Programms

Use the mouse and the left button to rotate the cube. The right button and mouse motion to zoom into the scene.
The code was tested with a Nvida GT6800 card. You’ll need nvidia GL library, Glew and SDLlib to build it from sources.

**Toonshading**

![glsl](http://optixx.org/images/glsl/glsl_test01.png)

**Deformation**

![glsl](http://optixx.org/images/glsl/glsl_test02.png)

**Mipmapped Texture**

![glsl](http://optixx.org/images/glsl/glsl_test03.png)

[Source](http://optixx.org/download/glsl_test01.tar.gz)

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.