Created
September 5, 2011 19:43
-
-
Save aras-p/1195754 to your computer and use it in GitHub Desktop.
GLSL uniforms foo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// i = uniform location of vec4 array | |
// this is fine | |
glUniform4fv (i, 4, GL_FALSE, ptr); // load 4 elements of an array | |
// this is NOT fine! | |
glUniform4fv (i+0, 1, GL_FALSE, ptr); // this will set one element of an array | |
glUniform4fv (i+1, 1, GL_FALSE, ptr+4); // this and following may or might not work! | |
glUniform4fv (i+2, 1, GL_FALSE, ptr+8); | |
glUniform4fv (i+3, 1, GL_FALSE, ptr+12); | |
// i.e. you can't do arithmetic on uniform locations. To get uniform location of any individual | |
// array element you have to explicitly query it's location! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment