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
    Senior Member Regular Contributor
    Join Date
    Jan 2004
    Posts
    314

    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
    Member 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
    Member 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

Similar Threads

  1. glutMainLoopEvent() in another loop.
    By iKubik in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 12-18-2015, 09:23 AM
  2. Using opencl in loop
    By manuel in forum OpenCL
    Replies: 7
    Last Post: 05-20-2014, 11:16 AM
  3. opengl in loop help
    By asda333 in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 08-10-2013, 12:15 PM
  4. Using for loop in shaders
    By damma in forum OpenGL: GLSL
    Replies: 6
    Last Post: 10-14-2008, 08:43 AM
  5. Loop of GLUT
    By user089 in forum OpenGL: General
    Replies: 0
    Last Post: 05-21-2003, 07:12 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean