Example code from the OpenGL 4.0 Shading Language Cookbook
Example programs from David Wolff's OpenGL 4.0 Shading Language Cookbook, 1st Edition. The source code has been forked from the author's original repository just before it was updated for the second edition. This repository is for folks having the first edition.
To build these examples, you'll need:
- The latest version of the Unofficial OpenGL Software Development Kit (GLSDK).
- premake4 from Industrious One.
- GLM 0.9.3+, in order to build the examples in Chapter 8. The latest version of GLSDK includes version 0.9.4 of GLM. Updating to a higher version of GLM is easy but isn't mandatory. Download the latest version of GLM. Remove the existing
glm
directory in GLSDK and replace it with the contents of the GLM archive. Make sure to change the directory name to justglm
.
These examples have been fully tested on Windows with MSYS2 and Visual Studio 2010 Express.
- Install the GLSDK by following the instructions on their web site. In the process, you'll also install premake4. For our purposes, only three libraries in the SDK need to be built: glload, freeglut and glimg. Here's a gist:
- Go to
GLSDK
directory and runpremake4 gmake
orpremake4 vs2010
. - Now go to
glload
directory and runmake
. Do the same forfreeglut
andglimg
directories.
- Go to
- You've the GLSDK ready; now edit
premake4.lua
in this repository's root directory to make the variableglsdk_lua
point to your GLSDK'slinks.lua
file. - Run
premake4 gmake
to create the make files (or)premake4 vs2010
to generate the project and solution files. - Run
make
if you've MSYS2. If you chose Visual Studio then open the solution, and build!
If you've a problem with any of these, report issues accordingly.
At the time the book was written, I thought that using Qt would make the examples quite portable and easy to compile within Qt Creator. Unfortunately, Qt Creator has changed since the time of the writing of the book. It has become more unwieldy to install, and in my experience has become extremely slow to boot. In addition, it is not widely used.
Secondly, since the time of the book's writing, I have experienced problems with GLEW under a 4.0 core profile. When doing some research it appears that there are some fundemental issues with GLEW and core profiles.
Due to the above issues, and to make the code more available and hopefully easier to use, I have ported the code over to use GLLoad and FreeGLUT via the GLSDK.
The major changes are listed below:
- Dropped dependence on Qt.
- Uses FreeGLUT, GLM, GLLoad, and GLImage via the GLSDK.
- Dropped dependence on libnoise for Chapter 8 examples. Instead, uses the noise functions available in GLM > 0.9.3.
- Currently, the noise examples (Chapter 8) don't look quite right due to the move to GLM. Fix noise examples (chapter 8) to look better.