Anton's OpenGL 4 Tutorials - Book Information

I try to collect all known typos and errors in the book and any known code problems here. I regularly update the online edition of the e-book as well as the source code.

Errata and Known Typos

I wait until a list of outstanding issues here gets reasonably large and then update the on-line volume. You may get a notification that you can update the e-book.

Source Code

All of the demo code can be found online at https://github.com/capnramses/antons_opengl_tutorials_book.

31 August 2015

The latest version of the GLFW links against some new external libraries. If you are linking against the static build you'll need to update your Makefiles accordingly.

Dynamic libraries on 64-bit GNU/Linux with C99:

DYN_LIBS = -lGL -lX11 -lXxf86vm -lXrandr -lpthread -lXi -lXinerama -lXcursor \
-ldl -lrt -lm

Frameworks on OS X:

FRAMEWORKS = -framework Cocoa -framework OpenGL -framework IOKit \
-framework CoreVideo

7 August 2015

I got a Mac Mini and personally tested all the demos on OS X Yosemite. I updated the Makefiles to make Apple builds easier - you no longer have to uncomment the version hint section, it's defined in the Makefile.

I found and fixed one or two bugs that only the Apple implementation picked up - the Kernel demo used an undefined shader variable, for some reason shader validation requires that a valid VAO is bound (!!), one or two shaders had keywords in the wrong order, and the texture shadows demo had some shader uniform location variables mixed up (that accidentally had correct values on other implementations!). The geometry shader demo was using a deprecated vertex count variable instead of gl_in.length().

Note that one or two demos are designed for GLSL 420, which isn't supported by Apple - I added some commented-out code blocks to make it easy to see how to retrograde these so that they run on OS X with 410.

28 January 2015

Added explicit glReadBuffers (GL_NONE) to 38_texture_shadows to protect against invalid framebuffer error on Apple. Note that this isn't actually valid in GL4 (seems to be from ES2/3).

26 November 2014

Updated all the shaders' version tags to #version 410 to properly support layout (location=x) keywords for attributes. The Hello Triangle demo is also updated to run OpenGL 4.1 instead of 4.0. I have not tested the Visual Studio demos yet.

I also noticed that the texture coordinates for 15_phong_textures were wrong, so generated a new mesh, and a new ambient occlusion map. I left the .blend file in that folder.

26 August 2014

Updated the code for Extension Checking and the Debug Callback to use switches to get error strings rather than arrays, which were slightly wrong (thanks Kenneth!).

31 July 2014

I moved the demo source code to GitHub https://github.com/capnramses/antons_opengl_tutorials_book. Hopefully this will eliminate problems due to unreliable downloads from my web server.

I have a few updates to make and small issues to fix, so expect this to change a bit over the next week.

4 July 2014

Found some shader calls to deprecated texture2D() and replaced with texture(). Also removed texture binding keywords from the #version 400 shaders (required 420). Left a few shaders at 420 for comparison - note at top of shader files in question.

3 July 2014

My hosted server is occasionally aborting downloads too early - it might take a few attempts to get the files. Sorry about that - I'll move the code over to a reliable host after the holidays!

Uploaded quite a few Makefiles for Apple OSX. I haven't been able to test all of the demos on Apple yet (I don't have a Macbook myself), but most of them should work! There is no Apple build of the Freetype library. I'll get there eventually!

Found and fixed a bug in 02_shaders - thanks Andrea!

2 July 2014

The original code download was getting download errors (finishing too early) from my web host, Godaddy. Their support people said that it was too large (107MB), and getting time-outs, which I think is probably rubbish. I got rid of the protected download settings, which I suspect Godaddy was mis-managing. In any case, to get around this for now I have made the download smaller, and moved the Blender mesh files and Visual Studio project files into separate downloads:

After the summer holidays I'll look at moving all the code to a more stable host (potentially on Github or a professional source-code host). I'll also be revising my main OpenGL website so that the book is the main source of content for tutorials, and the site has articles for new and interesting things that I work on - I have Compute Shaders and some low-level optimisation techniques on my "after summer" list, powered by all the coffees that get :D. By all means send requests.

30 June 2014

I updated the source code download and revised and tested all of the project files. You should now find:

I intend to add a set of OS X Makefiles, but I need to borrow an Apple machine first to make sure that they work properly. For now, this is the general format that you should expect for an OS X Makefile. Note the use of Apple frameworks for the OS libraries, as well as for OpenGL itself:

BIN = hellot
CC = gcc
FLAGS = -Wall -pedantic -mmacosx-version-min=10.5 -arch x86_64 \
-fmessage-length=78 -UGLFW_CDECL -fprofile-arcs -ftest-coverage
INC = -I ../common/include -I/sw/include -I/usr/local/include
LIB_PATH = ../common/osx_64/
LOC_LIB = $(LIB_PATH)libGLEW.a $(LIB_PATH)libglfw3.a
FRAMEWORKS = -framework Cocoa -framework OpenGL -framework IOKit
SRC = main.c

  @echo ~~~~~~~~~~~~~~~~~~~~~~Building OS/X 64-bit~~~~~~~~~~~~~~~~~~~~~~~~~
  ${CC} ${FLAGS} ${FRAMEWORKS} -o ${BIN} ${SRC} ${INC} ${LOC_LIB}

Fixes and Updates Made to e-book

4 May 2016 (Edition 6 → Edition 7)

18 January 2016 (Edition 5 → Edition 6)

Shaders chapter:

Alpha Blending:

13 January 2016 (Edition 4 → Edition 5)

31 August 2015 (Edition 3 → Edition 4)

Fixed - 26 November 2014 (Edition 2 → Edition 3)

Fixed - 26 November 2014 (Edition 1 → Edition 2)

I re-worded several sections in the "Discussion" chapter to clarify the guide to building larger programmes, and reduce the functions listed from my utility file.

Fixed - 1 August 2014 (Edition 0 → Edition 1)