Passing array into GLSL shader.

Hi All.I need to pass a uniform into GLSL shader program in Unity.I looked into available property types for shaders but they don’t include arrays.
So how can I write something like this:

uniform vec1  amplitudes[ 12 ];

So that it would be visible to the outside world and can pass this uniform into the shader in run time.?

Thanks .

Would you mind sharing your answer?

4 Answers

4

You want to look at glUniformMatrix4fv

See: http://www.opengl.org/sdk/docs/man/xhtml/glUniform.xml

Assuming your GL version is 2.1 or higher

Also be sure to visit GLSL : common mistakes - OpenGL Wiki

Also be sure to visit GLSL : common mistakes - OpenGL Wiki

Man ,read carefully the question.I work with Unity .Unity has no ability to pass arrays into GLSL shaders.I checked it by my own.glUniformMatrix4fv can contain only 16 numbers.This question can be closed.