Results 1 to 4 of 4

Thread: defining and manipulating 4x4 matrices

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2004
    Location
    Singapore
    Posts
    16

    defining and manipulating 4x4 matrices

    I would like to multiply a matrix by some rotation and translation matrices. Can someone please give me an example of how to define a 4x4 matrix? DO we enter it row by row or column by column?

    Can i vector multiply by (*)?

    Many thanks!!

  2. #2
    Super Moderator OpenGL Guru imported_dorbie's Avatar
    Join Date
    Jul 2000
    Location
    Bay Area, CA, USA
    Posts
    3,966

    Re: defining and manipulating 4x4 matrices

    You can answer this question easily by loading an indentity matrix on the modelview, calling glRotate and reading the matrix result.

    From the OpenGL FAQ:
    http://www.opengl.org/resources/faq/...formations.htm

    [qoute]
    9.005 Are OpenGL matrices column-major or row-major?

    For programming purposes, OpenGL matrices are 16-value arrays with base vectors laid out contiguously in memory. The translation components occupy the 13th, 14th, and 15th elements of the 16-element matrix.

    Column-major versus row-major is purely a notational convention. Note that post-multiplying with column-major matrices produces the same result as pre-multiplying with row-major matrices. The OpenGL Specification and the OpenGL Reference Manual both use column-major notation. You can use any notation, as long as it's clearly stated.

    Sadly, the use of column-major format in the spec and blue book has resulted in endless confusion in the OpenGL programming community. Column-major notation suggests that matrices are not laid out in memory as a programmer would expect.

    [/QUOTE]

  3. #3
    Super Moderator OpenGL Guru imported_dorbie's Avatar
    Join Date
    Jul 2000
    Location
    Bay Area, CA, USA
    Posts
    3,966

    Re: defining and manipulating 4x4 matrices

    P.S. you'll only be able to vector multiply if you have a class that has implemented a method to do su. There is no C or C++ code for matrix support in OpenGL, it's just a brainless array of floats.

    OpenGl will perform appropriate vector multiplies during the transformation process but that is an automatic internal detail.

  4. #4
    Junior Member Newbie
    Join Date
    Feb 2004
    Location
    Singapore
    Posts
    16

    Re: defining and manipulating 4x4 matrices

    I got it! All thanks to your help, dorbie.

Similar Threads

  1. Defining textures for VBOs
    By Bhoot123 in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 08-26-2018, 10:50 PM
  2. defining relationships
    By kevt in forum COLLADA
    Replies: 1
    Last Post: 04-01-2005, 08:25 PM
  3. Error defining Varible
    By nukem in forum OpenGL: Advanced Coding
    Replies: 18
    Last Post: 12-09-2002, 01:17 PM
  4. Defining object structures
    By nexusone in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 01-17-2002, 06:47 AM
  5. Texture defining
    By Zengar in forum OpenGL: General
    Replies: 5
    Last Post: 09-19-2001, 07:48 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