Hello Roni,
>> For example indexing an array like this:
>> arr[ind]
>> works fine for the vertex shader, but doesn't compile on the fragment
>> shader, saying that the index has to be constant, so that arr[ind] is
>> not
>> allowed, but arr[3] is ok.
>> However, since I'm using long arrays (70 elements), I don't know how
>>
> to
>
>> work
>> around this limitation.
>> Any ideas
Stupid suggestion, perhaps you can do this? (not sure you can pass an
array to a function, but worth a try...)
vec4 indexArray(vec4[n] array, int i)
{
if (i == 0) return array[0];
if (i == 1) return array[1];
// ...
// error add more indices to the function!
}
Then call
vec4 value = indexArray(arr, ind);
Just to work around the limitation...
Let me know if you try this, I'd be interested to know if it works.
J-S
--
______________________________________________________
Jean-Sebastien Guay [EMAIL PROTECTED]
http://www.cm-labs.com/
http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org