The limits of future compatible OpenGL 3.0
Return to home page
Comments Loading...
2008-09-13

Right now there's an NVidia driver for OpenGL 3.0 on Windows. That's it... nothing more. This has caused by a small problem with shaders. I've been working hard to remove all the deprecated entry points and defines in OpenGL, but I can't do that as easily in the OpenGL Shader Language (GLSL) 1.30 changes.

All of the fixed-functionality variables, gl_Color, gl_Texcoord, glFragData, gl_FragColor, so on and so forth... they're all gone. The syntax for GLSL has also changed slightly. The new spec defines 'in' and 'out' which is pretty obvious. You need it too to specify an 'out' vector in a fragment shader for your output colour.

The only way to set the output colour in a fragment shader is to set gl_FragColor or gl_FragData.. but both of these are deprecated, so how are you meant to do it now? Well, you define an out vector and then you bind that variable to an output buffer. This is pretty neat and generalized. The function call to glBindFragDataLocation works, but we have a problem...

Because we don't have an OpenGL 3.0 driver, we don't have access to the GLSL 1.30 language. In GLSL 1.20 you -cannot- have a varying vector in a fragment shader, thus you cannot actually use glBindFragDataLocation.. thus you cannot write to the output buffers using a "future compatible" OpenGL 3.0 sort of style.

Bummer. So while our OpenGL programs can be future compatible, our GLSL programs cannot. Syntax changes, built in changes, variable changes mean that no matter what we do - right now, all your fragment shaders will have to be touched up again. At least your vertex shaders can stay mostly the same, though the in/out syntax change will have to be applied.

This is a big problem because it's unlikely we'll see OpenGL 3.0 drivers spread about everywhere for a long while. Sigh.