1
votes

I'm using apple's opengl shader builder to learn GLSL.

And the problem I'm having is that I do not understand how to modify the uniform I defined in a frag shader.

enter image description here

As you can see I have a uniform variable named "someValue" with type GL_INT.

And in the Symbols view it shows three blank field for me to filled out.

The variable I defined is in GL_INT type so which blank should I use anyway and why is there 3 blank fields ?

And for the uniform "tex":

enter image description here

say I have 3 texture in slot 0 ~ 2.

What should I fill in the 3 blank fields to change the texture I want to use ? (I tried some combination and it seems only the second blank will do the work -- eg. fill in 1 for GL_TEXTURE1)

1
If you read the docs there's a section titled "Modifying Uniform Variables" that explains it.user1118321
Actually, looking more closely, it doesn't explain much. I'd file a Radar on that.user1118321

1 Answers

0
votes

It is explained in the "Modifying Uniform Variables" section of this article: https://developer.apple.com/library/mac/documentation/GraphicsImaging/Conceptual/OpenGLShaderBuilderUserGuide/Tasks/Tasks.html

In the section on the bottom, the controls are shown for whichever uniform that you have selected on the top.

Some Uniform variables have more than one value (for example, a vec3 has vec3.r vec3.g vec3.b (which can also be referenced as x,y,z)), and there will be a separate controller for each value in the uniform variable.

Now, Apple wants you to play around with your shaders a little bit, so they've given you the ability to write in three potential numbers for each value in a uniform. The idea is that you put in some numbers and then use the slider below to "morph" between those numbers, and then see what happens inside of your shader as a result.

In the case of a texture, you will probably want to set all three fields to the same value.