Help end child hunger

GLSL Core Tutorial – Index

Prev: Texturing with Images Next: Pipeline

The Graphics Pipeline

OpenGL Setup

GLSL Syntax

Communication Application => Shader

Inter Shader Communication – Interfaces

Some notes before diving into the examples

Shader examples

Cube – This is the first example of this tutorial. It is quite simple on purpose, it just covers the basics to get our geometry on screen. It uses uniform blocks, and it shows how to transform points using the projection-view-model matrix.


Colored Cube – In this second example we talk about several approaches on how to set color. We explore colour as a vertex atribute, and setting color with uniform variables. We also introduce the theme of debugging shaders using color to display input or computed values.


spotlight Lighting – Lighting is essential in CG. This example goes through the basic theory and implementation of simple local lighting, using both Gouraud and Phong shading models for three common light types: directional, point and spot lights.



tcDemoPlaying with Texture Coordinates –  Texture coordinates are commonly used to define how an image maps to a surface. However texture coordinates are not restricted to perform this mapping. Texture coordinates per se can be used to color a model. Here we will see a couple examples of how texture coordinates can be used on their own and explore a few new GLSL functions, such as mix and smoothstep.


texturedImage Texturing –  Images are commonly used as wallpaper applied to 3D shapes to create a variety of effects. In this section we focus on the OpenGL and GLSL typical scenario of texture usage, and explore a few new GLSL functions, such as textureSize, textureQueryLod, and textureQueryLevels.


Source code and a VS2010 project are also included in each example.


Prev: Texturing with Images Next: Pipeline

Leave a Reply

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

%d bloggers like this: