Results 1 to 2 of 2

Thread: 2D transformations

  1. #1
    Senior Member Regular Contributor
    Join Date
    Oct 2007
    Location
    Phoenix, AZ
    Posts
    109

    2D transformations

    I am converting a 2D software rendering application to OpenGL. Treating all drawn points with a Z value of 0 and using this to setup my projection matrix:
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    gluOrtho2D( [my pixel dimentions] );

    The existing code used a 3x3 matrix to convert the model to the display device.

    For the modelview matrix, I go from the existing 3x3 matrix to opengl's 4x4 matrix.

    Which cells transfer to which?

    Specificly, the x, y translation parts.

    m[0] m[4] m[ 8] m[12]
    m[1] m[5] m[ 9] m[13]
    m[2] m[6] m[10] m[14]
    m[3] m[7] m[11] m[15]

    I tried them in cells 8 and 9 first. It kind of worked, but didn't scale correctly as 0 and 5 changed. I read something where the author felt that the 4th column is where translation lives in a 4x4 matrix. So I tried cells 12 and 13. But now the model is nowhere to be seen.

    What am I missing?


  2. #2
    Senior Member Regular Contributor
    Join Date
    Oct 2007
    Location
    Phoenix, AZ
    Posts
    109

    Re: 2D transformations

    Nevermind, I found the problem.

    In ortho2d, I had my bottom and top values reversed.

    cells 12 and 13 seem to be the right places for the transformation values.

Similar Threads

  1. Hardware Transformations vs Software Transformations
    By killersquirrelz in forum OpenGL: Advanced Coding
    Replies: 5
    Last Post: 12-05-2004, 04:43 AM
  2. Transformations
    By Balu in forum OpenGL: Basic Coding
    Replies: 6
    Last Post: 11-03-2003, 09:31 PM
  3. transformations...
    By in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 09-05-2002, 10:43 PM
  4. Help on transformations
    By KurtCob in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 09-12-2000, 06:46 AM
  5. Replies: 1
    Last Post: 08-30-2000, 10:54 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean