open gl coding, animating an object

This is a discussion on open gl coding, animating an object within the Game Programming forums, part of the General Programming Boards category; ok i have this assignment which involes creating a asteroid field using glut/open gl our current task is to present ...

  1. #1
    Registered User
    Join Date
    May 2002
    Posts
    84

    open gl coding, animating an object

    ok i have this assignment which involes creating a asteroid field using glut/open gl

    our current task is to present randomly placed asteroids which are textured and light, however i would like to go a bit further than that. i want the asteroids that i have created to spin/rotate in the program, but i have no idea how to get them to spin.

    this is how the asteroid is drawn in screen in the renderscene function.

    lPushMatrix();
    glTranslatef(location1.getnumber(),location2.getnu mber),location3.getnumber());
    glScalef(0.5,0.5,0.5);
    glCallList(asteroid4pt);
    glPopMatrix();

    how do i make them rotate to give them a better 3d feeling than just lighting and textures?

  2. #2
    mov.w #$1337,D0 Jeremy G's Avatar
    Join Date
    Nov 2001
    Posts
    704
    glRotate3f(float ammount, float x, float y, float z);
    I dont remember if ammount is in degrees or radians.


    make sure you call rotate in the pushed matrix, before any translation. if you call it after the translation the rotation is still done in relation to the origin and gives unwanted effect.
    c++->visualc++->directx->opengl->c++;
    (it should be realized my posts are all in a light hearted manner. And should not be taken offense to.)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Open GL issues
    By drdodirty2002 in forum C++ Programming
    Replies: 1
    Last Post: 12-15-2005, 03:57 PM
  2. Open GL header files
    By Rune Hunter in forum C++ Programming
    Replies: 1
    Last Post: 10-03-2005, 02:10 AM
  3. Open GL programming
    By insane in forum C++ Programming
    Replies: 2
    Last Post: 05-04-2003, 12:28 AM
  4. Complete Open GL Newbie
    By Krak in forum Game Programming
    Replies: 21
    Last Post: 05-01-2003, 09:19 AM
  5. Open Gl (FIRST, and SECOND) programs
    By Jeremy G in forum Game Programming
    Replies: 3
    Last Post: 02-16-2003, 04:39 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21