このgifsinewave
に似た、動く円によって生成される小さなアニメーションに取り組んでいます。
glutWireTorus
ただし、サークルに使用すると奇妙な問題が発生します。他のすべての描画コードをコメント アウトし、トーラスを z 軸に沿って移動させたままにしても、その内側に点滅する線が表示されます。
これは、すべてが描画される表示機能です。表示機能をアイドル機能として使用します。また、アイドル機能を作成してそこに更新コードを配置することで問題があるかどうかを確認しましたが、それでも持続しました。
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;
}
}