command "if" in CG


#1

Hi…
I need to choose the smallest value in a “vector” and store its index. I tryed yhis piece of code, but the if test never works - actually, I always get a black screen as result.

for (i = 0; i < 64; i++) {
if (a[i] < b) {
b = a[i];
index = i;
} }

I’m using a geforce 6800 and compiling with profile fp40.

to debug I tryed to insert a result color inside the if (didnt work) inside the for(work) and outside the for (work after and before)

what am I doing wrong?


#2

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.