25/03/2009 OpenGL 3.1 released at GDC 2009!

Such an unexpected event! OpenGL 3.1 and GLSL 1.4 got released at GDC 2009. I was actually expecting it for Siggraph 2009 as usual but the ARB releases OpenGL 3.1 really fast this time! The amount of work is however quite significant and I'm going to present some aspects of it.

Two specifications are actually availabled. One specification with all the deprecated features included and one specification with some deprecated features removed. For the books, the specification with the deprecated features are the speficiation without the deprecated features plus the extension GL_ARB_compatibility. Obviously, isn't it? This is quite a shift according what was initially planned with the WGL_CONTEXT_FLAGS of WGL_ARB_create_context. nVidia is completely against the idea of removing the deprecated features so basically in the drivers nothing is going to change for a while. nVidia claims the idea that they want to keep them, that their customers need these features, which is true but which doesn't simplify the developer work and a good pratice learning process. I wrote "some deprecated features removed". I'm not exactually sure of what was deprecated. I thought triangle fan were but they are still part of OpenGL 3.1 specifications ... It's the kind of feature I would have enjoy to see going away! GL_NV_primitive_restart might give a second life for strips ans fans. In other hand, display list are deprecated ... and I'm not really happy about it. They are still very useful to me to create immutable objects for OpenGL states. There is no other feature to do so. However, I think that display list become more and more complicate to use because lot of extensions doesn't allow to register some functions in the display list ... I would enjoy some immutable states objects or so for those or individual object groups. Blend object, test object, rasterizer object, etc. I'm actually wondering how the ARB expect to manage deprecated feature in the future. How are they going to name the new deprecated extensions? Further, features are going to be deprecated like most of the glUniform* functions, hopefully some draw calls and obviously more through time. I would have expected some kind of GL_ARB_compatibility_30 to say that all the features of OpenGL 3.0 are supported and in the future we could expect some kind of GL_ARB_compatibility_31 for some deprecated features from OpenGL 3.1 in OpenGL 3.2 for example.

This is THE feature I was expecting! This extention is an evolution of GL_EXT_bindable_uniform with a lot of improvements. It's purpose is to reduce or replace the calls of glUniform* functions to set every single uniform variable of a GLSL program. All the data are instead store in buffer objects. Beyond this feature from GL_EXT_bindable_uniform, GL_ARB_uniform_buffer_object provides the capability to use several buffers for a uniform block in a way close to transform feedback. It's also provide several profiles to let the compiler optimize dead uniform, through elimination layout(packed) or to make sure the interface remains as defined in the code layout(std140). So far the community feedback on this extension is excellent, as mine! :)

An extract of issue 47 of GL_ARB_uniform_buffer_object specification about the block layout qualifiers. Issues 48 and 75 gives further informations about the std140 packing.

  • Implementation may optimize the layout to remove inactive uniforms and otherwise restructure the layout for efficiency.
  • Application must query the GL for the uniform block layout.
  • Implementation may optimize the layout but must use the same layout across shaders so that the resulting layout can be shared by multiple shaders.
  • Application must query the GL for the uniform block layout.
  • Implementation must use the pre-determined layout, defined in this specification.
  • Application need not query the implementation for layout information as it can be determined by reading the shader and the specification.

This extension is directly promoted to core even if no one ever heard of it before. The extension specification are not even available yet. Whatever, this extension simply allows to copy a part of a buffer in an other which could be useful especially for softwares that use OpenGL and OpenCL together or maybe softwares that use transform feedback to modify some buffers but which need keeping the original data. A good feature, almost obvious those days.

GL_ARB_draw_instanced (draw several instances with a single draw call) and GL_ARB_texture_buffer_object (An access of a whole large buffer like a 1D texture) get promoted to core as expected. GL_NV_primitive_restart is also promoted to core. This extension allows to restart primitives in a single draw call. Like several glEnd() / glBegin() into a single draw call. It could be usefull for triangle fans but especially for triangle strips. I have never used it and I'm not planning to use it, indexed buffer gives better results in matter of vertex caching as far as I know. Finally, GL_ARB_texture_rectangle get promoted to core! I wasn't especting it anymore, this extension is so old now and the ARB had initially decided not to promote it because of the non power of two textures of OpenGL 2.0. I'm glade, they change their minds, I'm still using this extension and enjoying it really much!

OpenGL 3.1 required graphics card that support at least 16 texture units in a vertex shader and provides SNORM texture formats.

An extension that a lot of people was expect to see promoted to core, the false good idea: GL_ARB_geometry_shader4. I don't like geometry shaders which I still believed should be called primitive shaders but anyway in pratice this feature is not really useful except for few cases. Also missing but which would have been nice to have: GL_EXT_texture_swizzle and GL_EXT_vertex_array_bgra for more compatibility with Direct3D. Finally, but no one was actually expecting it soon: GL_EXT_direct_state_access. This extension still need some work from my point of view but when it's going to be really, it's going to deeply change OpenGL programming! I plan to write about it later, dealing with my experience of it.

OpenGL 3.1 require the same level of hardware than OpenGL 3.0 which means GeForce 8, Radeon HD2000 and Chrome 400. nVidia already provides some beta drivers for OpenGL 3.1. Honestly, features support is far from compliant yet, no std140, column_major and row_major layout qualifiers in GLSL 1.4, no GL_ARB_uniform_buffer_object yet but it provides GL_ARB_compatibility (not much work to do...) and GL_ARB_copy_buffer. No doubt it's going to be available quite soon, I would say within 3 months. ATI already provides GL_ARB_texture_buffer_object (Catalyst 9.3) and GL_EXT_bindable_uniform (Catalyst 9.2), the work to OpenGL 3.1 is in the good direction. We can expect full support withim 6 months I guest. ATI publish a lot of new extensions recently I will coming back to this in a next topic.

My overall first impression of OpenGL 3.1 is good especially because of this wonderful GL_ARB_uniform_buffer_object extension and also the promotion to core of GL_ARB_texture_rectangle which makes it reliable for the future. The deprecation model seems still odd to me and I'm not sure it's going to be reliable or changed anything soon. The ARB remains active and I'm looking forward OpenGL 3.2 ... at Siggraph 2009? At least I'm sure we would get news about it during this event!

GLI 0.1.0.0 released >
< G-Truc Creation: Version 5 unleashed!
Copyright Christophe Riccio 2002-2016 all rights reserved
Designed for Chrome 9, Firefox 4, Opera 11 and Safari 5