legends2k / glslcookbook

Code for OpenGL Shading Language Cookbook, 1st Edition

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

Requirements

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 just glm.

Compiling the examples

These examples have been fully tested on Windows with MSYS2 and Visual Studio 2010 Express.

  1. 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 run premake4 gmake or premake4 vs2010.
    • Now go to glload directory and run make. Do the same for freeglut and glimg directories.
  2. You've the GLSDK ready; now edit premake4.lua in this repository's root directory to make the variable glsdk_lua point to your GLSDK's links.lua file.
  3. Run premake4 gmake to create the make files (or) premake4 vs2010 to generate the project and solution files.
  4. 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.

From the Author

Changes from the book

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.

TODO

  • 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.

About

Code for OpenGL Shading Language Cookbook, 1st Edition


Languages

Language:C++ 83.4%Language:GLSL 13.0%Language:Lua 1.8%Language:JavaScript 1.7%Language:C 0.0%