opengl - default uniform (array) values -


rather explicitly setting uniform data gl program, set 'defaults' in simple test (fragment) shader with:

uniform vec3 face_rgb[] = vec3[] (     vec3(0.0, 0.0, 1.0), vec3(0.0, 1.0, 0.0), vec3(1.0, 0.0, 0.0),     vec3(1.0, 0.0, 1.0), vec3(0.0, 1.0, 1.0), vec3(1.0, 1.0, 0.0),     vec3(0.2, 0.2, 0.2), vec3(0.0, 0.0, 0.0) ); 

depending on fragment's texture coordinates, index value formulated rgb value. (the actual rgb values immaterial)

this works os x (gl 3.2 core profile). in fact, far better using index const array. question - valid glsl syntax, , not implementation-dependent hack? (i have no 4+ access @ moment, assume answer still applies). also, ideas why uniform might outperform constant array?

yes, uniform arrays allowed have default values in gl 3.2. syntax valid.

that doesn't mean work, it's valid. driver bugs can still you.


Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -