Help end child hunger

Shader Examples

Prev: Varying Variables Next: Hello World in GLSL
 
Hello World

This pair of vertex/fragment shaders is about the smallest pair we can write. It performs only the standard vertex transformation, and sets the same color for all pixels. It shows several ways of achieving the vertex transformation, and introduces the some of the matrices provided available in GLSL.

Color Shader

A simple example of how to get the color specified in an OpenGL application, using glColor, all the way to the fragment shader.

Flatten Shader

This is a simple example of vertex manipulation. It starts out by flattening a teapot, and it ends up with a vertex shader that animates a wavy teapot, based on a uniform variable to keep track of time.

Toon Shader

In this tutorial it will be shown the impact of placing certain computations on the vertex shader vs. the fragment shader. It uses varying variables to establish communication between shaders, and shows how to access an OpenGL lights position.

Lighting Shaders

Lighting according to the “Mathematics of OpenGL” (chapter of the Red Book) lighting is presented in here. The tutorials starts with a directional light per vertex, i.e. as in OpenGL fixed functionality, and then moves on to per pixel implementations of directional, point and spot lights, all according to the Red Book equations.

Texturing

This tutorial starts from basic texturing, accessing texture coordinates and texels, and moves on to a multitexturing example where one of the texture units is applied to give a glow in the dark effect.

 

Prev: Varying Variables Next: Hello World in GLSL
 

Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© 2014 Lighthouse3d.com Suffusion theme by Sayontan Sinha