Hello Guest

A question about ARBShaderObjects, [method]ARB, etc.

  • 3 Replies
A question about ARBShaderObjects, [method]ARB, etc.
« on: April 25, 2012, 18:02:25 »
I ran into this Q/A on Stackoverflow: http://stackoverflow.com/questions/8425630/passing-matrices-to-glsl-just-wont-work/10281376

You are not using GLSL 1.20. I know this because all of your calls end in ARB, which means you are using the ARB_shader_objects extension, which doesn't allow GLSL 1.20. Or if it does, it only works by accident. Don't use GLSL as an extension; use it as a core feature (no ARB suffix).

Is there any truth to this? I was able to get Mat4x4 (or Mat4 anyway) uniforms to work using ARBShaderObjects, but I have noticed I can't use '#version' in my shaders and have them compile. I had assumed it was the antiquity of my video card setup, but I'm wondering if this is actually the case? I myself use ARB for everything.

Also another comment:

@Nicol Bolas: where have you found that ARB_shader_objects doesn't allow GLSL 1.20? The specification states only that it is written against GLSL 1.10, but it doesn't say when it is applicable!

I know that ARB is supposed to allow the hardware to help dictate version, etc, is in use, instead of trying to force a particular version/implementation. Anyway, some help on this ARB/nonARB methods/classes would be greatly appreciated.


Offline spasi

  • *****
  • 2256
    • WebHotelier
Re: A question about ARBShaderObjects, [method]ARB, etc.
« Reply #1 on: April 25, 2012, 18:38:59 »
Technically, it's possible for an ARB extension and the corresponding functionality that was promoted to the core OpenGL to behave differently. But it's usually minor fixes. In the case of the GLSL APIs, here's what the OpenGL 2.0 says:

Small changes to the APIs for managing shader and program objects were made in the process
of promoting the shader extensions to the OpenGL 2.0 core. These changes do not affect the
functionality of the shader APIs
, but include use of the existing uint core GL type rather than the
new handleARB type introduced by the extensions, and changes in some function names, for example
mapping the extension function CreateShaderObjectARB into the core function CreateShader.

I haven't read anywhere that the ARB extension shouldn't support GLSL 1.20+. With that said, in my own projects I always try to use the core functionality when it's available. It's very easy to encapsulate different code paths for extension/core functionality behind an interface and use that in your code. Almost always the behavior is identical and you don't need to worry about which implementation is used.

Btw, the most recent ARB extensions (GL 3.1+) have been introduced at the same time as the corresponding GL spec. You'll notice that their functions miss the ARB postfix, which means they're exactly the same functions as the core ones.

Re: A question about ARBShaderObjects, [method]ARB, etc.
« Reply #2 on: April 26, 2012, 00:43:41 »
So basically, don't use the ARB functions with the ARB suffixes, use them as core functionality?

I switched everything I could from ARB to the GL20 functions, and now it doesn't balk at

#version xxx

statements. Methinks....

this was an important discovery, at least for my ignorant auto-didact self. Thanks, Spasi!
« Last Edit: April 26, 2012, 01:18:12 by RiverC »

Re: A question about ARBShaderObjects, [method]ARB, etc.
« Reply #3 on: April 26, 2012, 02:26:02 »
Additionally, not to do to much doubleposting, it seems to have resolved my Mac tester's issues. Although this may have been the phantom mat4x4 issue, which is to say

mat4x4 is the same as mat4, but mat4x4 doesn't seem to work in some cases.