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
Post a Comment