tgbt
10-16-2005, 11:48 PM
hi.
I'm learning about GLSL.
Appearing below is a GLSL fragment source code I wrote for experiment.
uniform int N_LOOP;
void main(void)
{
int i;
float tmp=0.0f;
for(i=0; i<N_LOOP; i++){
tmp += 0.1f;
}
gl_FragColor = vec4(tmp, 0.0, 0.0, 0.0);
}And, I set N_LOOP by written the below code.
glUniform1iARB(glGetUniformLocationARB(_programObj ect, "N_LOOP"), nLoop);I think that the result of this program is depend on nLoop but the result I got was similar to vec4(0.1, 0.0, 0.0, 0.0).
It seems that for-loop doesn't works dynamically.
Does GLSL support dynamic loop like I used above ?
(Is this written in specification or FAQ ?
I didn't find such description.)
Would you please give me some advice ?
Thanks.
P.S.
My execution environment is GeForce6800GT(AGP).
When I wrote same program in HLSL and executed, the result is similar to (0.1*N_LOOP, 0.0, 0.0, 0.0).
I'm learning about GLSL.
Appearing below is a GLSL fragment source code I wrote for experiment.
uniform int N_LOOP;
void main(void)
{
int i;
float tmp=0.0f;
for(i=0; i<N_LOOP; i++){
tmp += 0.1f;
}
gl_FragColor = vec4(tmp, 0.0, 0.0, 0.0);
}And, I set N_LOOP by written the below code.
glUniform1iARB(glGetUniformLocationARB(_programObj ect, "N_LOOP"), nLoop);I think that the result of this program is depend on nLoop but the result I got was similar to vec4(0.1, 0.0, 0.0, 0.0).
It seems that for-loop doesn't works dynamically.
Does GLSL support dynamic loop like I used above ?
(Is this written in specification or FAQ ?
I didn't find such description.)
Would you please give me some advice ?
Thanks.
P.S.
My execution environment is GeForce6800GT(AGP).
When I wrote same program in HLSL and executed, the result is similar to (0.1*N_LOOP, 0.0, 0.0, 0.0).