12/04/2010 OpenGL Samples Pack released (Updated)

The OpenGL Samples Pack is available and it catches up with some of the main features of OpenGL: Uniform Buffer, transform feedback and instanced array.

Another aspect of this release is the change for 2 design policy: A semantics location approach instead of a query location approach and a generalized use of VAOs. Am I not the developer who think VAOs are evils? Well, I am but thanks to Graham Sellers, AMD OpenGL manager, I have a better idea of how good VAOs are. Again, such a demonstration of the good will toward OpenGL, my feeling for a shiny OpenGL future keep increasing: GOOD!

Let's say that you can espect about +20% with VAO if your bottleneck in on the draw call and if you draw less than 2000 different VAOs (/ meshes) with enough attributes. It is already something and we can't say anymore that VAOs are evil. On nVidia the limit is about 200 different VAOs (/ meshes) which is seriously an issue from nVidia implementation. With an appropriate manager, glDrawElementsBaseVertex and changing the element array buffer, we can put several meshes per VAOs and actually reduce the number of VAOs to really a few. It requires a bit of software design and feels an bit odd (half-mutable VAOs) but it's possible to make this VAOs count limit not a problem.

For a while I thought (and I believe most of the community members) that VAOs were optionals. Most of us ignore it because we didn't see any improvement and VAO brings a software design constrain if we rely on something like immunable VAOs. Well, VAOs are REQUIRED with OpenGL core profile and as I discovered it, it's not so bad if we know these limits. (2000 VAOs on AMD and 200 VAOs on nVidia).

Mutable VAO for OpenGL core profile to replace the deprecated default VAO:
  • glGenVertexArrays(1, &this->VertexArrayName);
  • glBindVertexArray(this->VertexArrayName);
Proper use of 'immutable' VAO:
  • glGenVertexArrays(1, &this->VertexArrayName);
  • glBindVertexArray(this->VertexArrayName);
  • glBindBuffer(GL_ARRAY_BUFFER, this->BufferName);
  • glVertexAttribPointer(glf::semantic::attr::POSITION,
  • 2, GL_FLOAT, GL_FALSE, sizeof(vertex), GLF_BUFFER_OFFSET(0));
  • glVertexAttribPointer(glf::semantic::attr::TEXCOORD,
  • 2, GL_FLOAT, GL_FALSE, sizeof(vertex), GLF_BUFFER_OFFSET(sizeof(glm::vec2)));
  • glBindBuffer(GL_ARRAY_BUFFER, 0);
  • glEnableVertexAttribArray(glf::semantic::attr::POSITION);
  • glEnableVertexAttribArray(glf::semantic::attr::TEXCOORD);
  • glBindVertexArray(0);

I hope to find some time to write something about that topic including a dedicated test, including a possible improvement with 'bindless graphics' which might lead to about +100% efficiency when/if available in future OpenGL specification.

All the samples run on AMD OpenGL 4.0 drivers, all but one sample run on nVidia OpenGL 3.3 drivers.


The samples pack has been updated to fix an issue with the CMake project. A little issue that got here from my transition to Git! With nVidia OpenGL 4.0 drivers all the samples pass without any error.

OpenGL 3.4 / 4.1: Expectations / Wish-list (DSA!) >
< G-Truc Creation 6.4 released
Copyright Christophe Riccio 2002-2016 all rights reserved
Designed for Chrome 9, Firefox 4, Opera 11 and Safari 5