View Full Version : while loop

03-06-2005, 11:46 PM
im tring to use a while loop functionto try colouring different coloured triangles along a triangle polymesh how can i colour each one seperately, and not stop one colour being repeated?

here is the code im using for while loop

while((faceIndex!=-1) && m->C[faceIndex].r!=(1.0))
//makes a length of red terrain
m -> C [faceIndex].r =(1.0);
m -> C [faceIndex].g =(0.0);
m -> C [faceIndex].b =(0.0);
m -> C [faceIndex].a =(1.0);

here is the code im using in a previous function to call a triangle face

int myFace1, myFace2;

myFace1 = m -> E [myEdge]. f1;
myFace2 = m -> E [myEdge]. f2;

thanks jofoxy

03-07-2005, 12:26 AM
Got burnt with the for loop in the advanced forum, eh ;)

Anyway, it would help if you showed the code that actually rendered the triangles.

03-07-2005, 08:11 AM


Be carful when using floats or doubles when using an equate operator it's dangerous due to the normal limitation and rounding with floats and doubles

Try to use >= or <= rather than == or !=

03-07-2005, 08:12 AM
How are you drawing your polygons and how are you currently assigning colors to them when you draw them