Camera Movement

For general camera movement:

def draw():
    global cameraX, cameraY, cameraZ
    global cameraHeading

    glLoadIdentity()
    glRotatef(-cameraHeading, 0, 1, 0)
    glTranslatef(-cameraX, -cameraY, -cameraZ)

    drawObjects()


Inverting a transformation

Inverse of glTranslatef(x, y, z) is glTranslatef(-x, -y, -z)

Inverse of glRotatef(angle, x, y, z) is glRotatef(-angle, x, y, z)

Inverse of glScalef(x, y, z) is glScalef(1.0/x, 1.0/y, 1.0/z)


Inverse of a series of transformations is the inverses of the individual transformations, in reverse order.





next