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 2 of 2

Thread: Problem with animation

  1. #1
    Junior Member Newbie
    Join Date
    May 2014
    Posts
    2

    Problem with animation

    Hi everyone, I have a problem with animation. My program drawing spacecraft that contains cylinders (wire and solid from library of glut) and calculating angles of rotation for spacecraft. On the angles rotation I need will draw animation change of spacecraft at space. That I trying insert in my code glutTimerFunc my program just is closed. What is problem ?
    Code :
            public Form3()
            {
                InitializeComponent();
                AnT1.InitializeContexts();
                Glut.glutTimerFunc(50, Timer, 0);
            }
            void Timer(int value)
            {
                Gl.glRotated(1, 0, 0, 1);
                Draw();
                Glut.glutTimerFunc(50, Timer, 0);
            }
            void Draw()
            {
                Gl.glLoadIdentity();
                Gl.glColor3f(0.502f, 0.502f, 0.502f);
     
                Gl.glPushMatrix();
                Gl.glTranslated(-1, 0, -6);
                Gl.glRotated(95, 1, 0, 0);
                Glut.glutSolidCylinder(0.7, 2, 60, 60);
     
                next of similiarly of code
                ...
             }
    Rotation is carried out along three axes that will calculate. Please help. Time has double value.

  2. #2
    Junior Member Newbie
    Join Date
    Sep 2012
    Posts
    28
    I do not know why your program closes. But if you rotate in Timer(int) function and then in Draw() function you load matrix's identity nothing will happen. Try declaring a member variable and add a value to it in Timer(int) function, then rotate in Draw() function.
    P.S.: You're using an old OpenGL version.

Posting Permissions

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