0

I am working on a small animation of a sinewave being generated by a moving circle similar to this gif.

However I'm having a weird issue with using glutWireTorus for the circle. Even when I comment out all the other drawing code and leave the torus moving along the z axis alone, I get flashing lines on the inside of it:

Screenshot

This is the display function where everything is drawn. I use the display function as my idle function, also, I checked if that was the issue by creating an idle function and putting my update code there but it still persisted.

void display(void)
{
    glClearColor(0.f,0.f,0.f,0.f);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // clear the color buffer 
                                                           and the depth buffer

    glLoadIdentity();
    glTranslatef(0.0f,0.0f,-5.0f); //Push everything back 5 units into the scene, 
                                     otherwise we won't see the primitive 
    camera();    
    //yPrev = myCircle.y;

    glPushMatrix();         
    glTranslatef(0.0f,0.0f,t);
    glutWireTorus(0.02,1,100,100);   
    glPopMatrix();

    DrawAxes();    
    glutSwapBuffers(); //swap the buffers   
    glFlush();//Flush the OpenGL buffers to the window

    t-=0.002;

    if (t < -T)
    { 
        t = 0;
    }
}
Littm
  • 4,923
  • 4
  • 30
  • 38
Chocken
  • 53
  • 2
  • 8
  • 1
    How does your projection setup looks like? Also, does it keeps doing that even if you comment out `DrawAxes();` ? – Jan Spurny Sep 06 '12 at 11:29
  • If you want a circle that moves in space why do you use the glutWireTorus method this draws a donut like geometry – tiguero Sep 06 '12 at 16:11

1 Answers1

0

Uh, interesting, I run into the same problem. Here is the picture using parameter

glutWireTorus(/*innerRadius*/0.3, /*outerRadius*/0.5, /*nsides*/32, /*rings*/32);

torus.32x32

another picture using parameter

glutWireTorus(/*innerRadius*/0.3, /*outerRadius*/0.5, /*nsides*/64, /*rings*/128);

torus.64x128

We don't know why without glutWireTorus function implementation, but we can implements our own torus, or maybe someone can explain it?

KAlO2
  • 838
  • 11
  • 13