Results 1 to 3 of 3

Thread: Basic Animation

  1. #1
    Guest

    Basic Animation

    Hi,

    I'm using Glut and....

    I'm trying to do some basic animation:
    I have a cube and I would like it to
    move smoothly upwards,
    then once there move right;
    then move back down to the original height;
    finally it should move back to it's starting position.


    X----------X
    | |
    | |
    X----------X

    I must be really thick as I cannot see how to use the idlefunction to do
    this, all I manage is to get it to move upwards slowly to a certain point
    then I cannot get to to come down again, as I'm fighting against the
    idlefunction.....

    ideas??


    thanks

    Greg

  2. #2
    Senior Member Regular Contributor
    Join Date
    Nov 2000
    Location
    State College, PA
    Posts
    186

    Re: Basic Animation

    The idea that immediately comes to mind is a case statement:
    Code :
    switch(direction){
    	case up: translate up some more; break;
    	case left: translate left some more; break;
    	case down: translate down some more; break;
    	case right: translate right some more; break;
    }
    Put it in your idle function, and have a counter that switches your direction at the correct points.

    Chris

  3. #3
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    2,978

    Re: Basic Animation

    ... and after that, in the idle-function, you place glutPostRedisplay() to tell GLUT that you want to redraw the screen.

Similar Threads

  1. Very unsure about basic animation :S
    By Yeezymode in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 11-07-2012, 12:57 AM
  2. Basic animation
    By Debbie in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 11-07-2011, 02:21 AM
  3. Basic Animation in Collada
    By coders_gaint in forum COLLADA
    Replies: 5
    Last Post: 07-03-2009, 06:59 AM
  4. OpenGL graphic design -- basic animation -- HELP!
    By keebler in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 05-10-2008, 10:22 AM
  5. basic animation questions
    By in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 11-19-2000, 05:35 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