glTranslatef or related function

This is a discussion on glTranslatef or related function within the Game Programming forums, part of the General Programming Boards category; In OpenGL, to move around the screen you use glTranslatef(). But that moves from the last spot you glTranslatef()ed from...not ...

  1. #1
    l'Anziano DavidP's Avatar
    Join Date
    Aug 2001
    Location
    Plano, Texas, United States
    Posts
    2,738

    glTranslatef or related function

    In OpenGL, to move around the screen you use glTranslatef(). But that moves from the last spot you glTranslatef()ed from...not from (0,0,0) every time...

    Is there any function that moves from (0,0,0) every time so you can just store an objects screen position in a class?
    My Website

    "Circular logic is good because it is."

  2. #2
    Registered User
    Join Date
    Aug 2001
    Posts
    411
    glLoadIdentity() will reset the everything back to zero.

    so for a simple project, you could just call

    glLoadIdentity()
    glTranslatef()
    draw_model()

    for every object in your scene.

    You should know that this is not the most effiecent way to do that.

  3. #3
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,267
    use glPushMatrix() and glPopMatrix() if you don't want to lose the original translations
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. In over my head
    By Shelnutt2 in forum C Programming
    Replies: 1
    Last Post: 07-08-2008, 07:54 PM
  2. Message class ** Need help befor 12am tonight**
    By TransformedBG in forum C++ Programming
    Replies: 1
    Last Post: 11-29-2006, 11:03 PM
  3. Including lib in a lib
    By bibiteinfo in forum C++ Programming
    Replies: 0
    Last Post: 02-07-2006, 02:28 PM
  4. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 02:53 AM
  5. Question..
    By pode in forum Windows Programming
    Replies: 12
    Last Post: 12-19-2004, 07:05 PM

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