Thread: Rotating In OpenGL

  1. #1
    Registered User SubLogic's Avatar
    Join Date
    Jan 2003
    Posts
    33

    Question Rotating In OpenGL

    I'm experimenting with the MD2 Animation tutorial from www.gametutorials.com and have this object called g_3DModel, any idea how to rotate it, move it, etc?
    0100001

  2. #2
    Used Registerer jdinger's Avatar
    Join Date
    Feb 2002
    Posts
    1,065
    Use glRotate3f(), glTranslate3f(), etc.

  3. #3
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    glRotate*() and glTranslate*() functions modify the location of objects in the world relative to a stationary camera. So instead of moving the actual camera around the world, it will move the world around the camera. If you wanted this same effect but on the camera you would use the gluLookAt() function. The following code is an example from my book to help explain this more:

    Code:
    void PlaneView(GLfloat planeX, glfloat planeT, GLfloat planeZ, GLfloat roll, GLfloat pitch, GLfloat yaw)
    {
    	//roll is rotation on the z axis
    	glRotatef(roll, 0.0f, 0.0f, 1.0f);
    
    	//yaw (heading) is y rotation
    	glRotatef(yaw, 0.0f, 1.0f, 0.0f);
    
    	//pitch is rotation on x
    	glRotatef(pitch, 1.0f, 0.0f, 0.0f);
    
    	//move the plane to the planes world coordinates
    	glTranslatef(-planeX, -planeY, -planeZ);
    }
    When u picture this in use, imagine being in the piolet seat.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. rotating composite objects with OpenGL
    By elad in forum Game Programming
    Replies: 11
    Last Post: 10-19-2008, 07:04 AM
  2. Linking OpenGL in Dev-C++
    By linkofazeroth in forum Game Programming
    Replies: 4
    Last Post: 09-13-2005, 10:17 AM
  3. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM
  4. OpenGL .dll vs video card dll
    By Silvercord in forum Game Programming
    Replies: 14
    Last Post: 02-12-2003, 07:57 PM
  5. opengl code not working
    By Unregistered in forum Windows Programming
    Replies: 4
    Last Post: 02-14-2002, 10:01 PM