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: Need help in animating(scale)

  1. #1
    Junior Member Newbie
    Join Date
    Aug 2003
    Location
    Australia
    Posts
    7

    Need help in animating(scale)

    Hi all,
    I have a problem again(think should change my nick to problem_kid!!!)

    Im trying to produce a animation of a object(cube) and tried to scale it to double the size and back to the normal size and back and forth. I have used a glutTimerFunc to animate it. The problem is that my object will continue to get bigger til it disappear out of my viewing area. Why doesn't it go back to the normal size.

    my code :

    void timer(int value)
    {
    glScalef(1.0,1.0,1.0);

    x-= 0.1;

    if (x < 0.5 )
    {
    x= 1.0;
    }

    glutPostRedisplay();
    glutTimerFunc(20, timer,value);
    }

    //there is a glutTImerFunc in the main function.

    can anyone help please?

  2. #2
    Junior Member Newbie
    Join Date
    Aug 2003
    Location
    Atlanta, GA, USA
    Posts
    5

    Re: Need help in animating(scale)

    Is this your exact code? Cause your scale doesn't change?


    For a nifty effect, why don't you assign the scale to sign curve. That way it's groth pulses instead of just doing a 180.

    [This message has been edited by poo (edited 09-17-2003).]

  3. #3
    Senior Member OpenGL Pro
    Join Date
    May 2001
    Location
    Kristianstad,Skåne,Sweden
    Posts
    1,651

    Re: Need help in animating(scale)

    Hi !

    You cannot put the glScale call in the timer function, you should only update a variable to keep track of the current scale and call glutPostReDisplay(), in your display callback function you should put the glScale before you render the object and then it will work fine.

    Mikael

  4. #4
    Junior Member Newbie
    Join Date
    Aug 2003
    Location
    Australia
    Posts
    7

    Re: Need help in animating(scale)

    All,
    Thanks... i have solve the problem. Thank you all for your advise and help.

    Really appreciate it.

Posting Permissions

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