Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: while loop

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2004
    Location
    wales
    Posts
    12

    while loop

    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

  2. #2
    Member Regular Contributor
    Join Date
    Jan 2004
    Posts
    322

    Re: while loop

    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.

  3. #3
    Intern Contributor
    Join Date
    Feb 2004
    Location
    Dallas/ Nottingham
    Posts
    96

    Re: while loop

    FYI

    m->C[faceIndex].r!=(1.0)

    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 !=

  4. #4
    Intern Contributor
    Join Date
    Feb 2004
    Location
    Dallas/ Nottingham
    Posts
    96

    Re: while loop

    How are you drawing your polygons and how are you currently assigning colors to them when you draw them

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •