Results 1 to 2 of 2

Thread: [OpenGL] transformations and camera

  1. #1

    [OpenGL] transformations and camera

    Hey guys

    A little question.

    Unlike Direct3D, OpenGL combines the Model and view matrix into one. Lets say I want to render three objects that are positioned next to eachother. Calls like gluLookAt() and glTranslatef() will generate a matrix and multiply it with the existing one.
    After setting this matrix and rendering an object, I want to render another one with the same camera, but with a different translation.

    I could just setup the camera and call glTranslatef() a couple of times, but then you need to know the positions of the objects with respect to eachother. I could also rebuild the entire Modelview matrix for every object I render, but this seems Inefficient to me. glPushMatrix() and glPopMatrix() is also a possibility.

    What's the best way to do this? Any code would be helpfull.

    Thanks in advance
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  2. #2

    Re: [OpenGL] transformations and camera

    I believe the simplest technique is this:

    1. position your camera
    2. pushmatrix
    3. translate to objects position
    4. render object
    5. popmatrix
    6. repeat steps 2-5 for all objects
    ZGameEditor - Develop 64kb games for Windows.
    Thrust for Vectrex - ROM-file and 6809 source code.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •