开发者

Passing array of vec2 to Fragment Shader Opengl es 2.0

I am trying to pass in an array of vec2 to a fragment shader but i can't seem to work out how.

In my application i have the following array.

GLfloat myMatrix[] = { 100.0, 100.0,
    200.0, 200.0 };

glUniformMatrix2fv(matrixLocation, 2, 0, myMatrix开发者_如何学JAVA);

and in my fragment shader i am trying to access those values like so

uniform vec2 myMatrix[2];

gl_FragColor = gl_FragCoord.xy + myMatrix[0].xy;

however the fragcolor does not change which it should as if i hard code it to

gl_FragColor = gl_FragCoord.xy + vec2( 100.0, 100.0 ).xy;

Any ideas how i can pass these vec2 values into the shader

Thanks in advance

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜