GLSL Programming/GLUT

From Wikibooks, open books for an open world
Jump to navigation Jump to search

In this section we present how to implement the GLSL concepts using C/C++, with GLUT as the basic OpenGL wrapper.

We will rely on the base code template built step-by-step in the OpenGL Programming wikibook, for loading textures, models, as well as passing vertices and uniforms to the shaders. Almost all of the coding will occur in the shaders.

Note: Android users may want to have a look at the GLUT wrapper.

When re-implementing obsoleted OpenGL 1.x features (such as lighting) using shaders, we'll try to use similar variable names, so that people familiar with the previous version can easily upgrade their knowledge.

Tutorials[edit | edit source]

Note that the tutorials assume that you read them in the order in which they are presented here, i.e. each tutorial will assume that you are familiar with the concepts and techniques introduced by previous tutorials. If you are new to GLSL you should at least read through the tutorials in the “Basics” section.

A number of these tutorials are already available for Blender and Unity - if you can port them, feel free to contribute!

Basics[edit | edit source]

Transparent Surfaces[edit | edit source]

Basic Lighting[edit | edit source]

Basic Texturing[edit | edit source]

Textures in 3D[edit | edit source]

Environment Mapping[edit | edit source]

Variations on Lighting[edit | edit source]

Non-Standard Vertex Transformations[edit | edit source]


< GLSL Programming

Unless stated otherwise, all example source code on this page is granted to the public domain.