ABSTRACT

As of this writing, DSA is not a core feature of OpenGL 3.3, and as such, is not available on all platforms, although glProgramUniform*() calls are mirrored in the separate shader objects extension [Kilgard et al. 2010] which has become core functionality in OpenGL 4.1. Delaying selector-based OpenGL calls until draw time has a lot of benefits, although there are some OpenGL calls that you do not want to delay. It is important to allow the CPU and GPU to work together in parallel. As such, you would not want to delay updating a large vertex buffer or texture until draw time because this could cause the GPU to wait, assuming it is not rendering one or more frames behind the CPU. Finally, I’ve had great success using this technique in both commercial and open source software. I’ve found it quick to implement and easy to debug. An excellent next step for you is to generalize the code in this chapter to support all

85 

uniform types (vec2, vec3, etc.), uniform buffers, and other areas of OpenGL with selectors. Also consider applying this technique to higher-level engine components, such as when the bounding volume of a model in a spatial data structure changes.