Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 10 of 14

Thread: Another OpenGL (and Direct3D) matrices thread

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Member Regular Contributor
    Join Date
    Jan 2005

    Another OpenGL (and Direct3D) matrices thread

    Can some help me out with "column/row-major" matrices. It seems like either no one who comments on the subject can get the facts straight or something. Anyway I can still not figure this stuff out.

    I would appreciate clarification on the following points I've stumbled across, and ultimately I'd like to get this ( header straightened out. I think it is currently row-major but I've read stuff that would call it otherwise. I thought I was making it column major (as the opening comments suggest)

    A) I always thought row/column was laid out differently in memory but I keep reading that it isn't. If it isn't I don't understand how a transpose cannot result in the homogenous column/row not ending up in different places in memory. So why would you ever transpose to convert if so? Is it just for going between a 3rd convention not used by any major hardware API?

    B) Is this purely a multiplication ordering difference? If so why is there so much discussion on the topic online?

    C) I've read that people don't like GLSL because they like to pass matrices as 3 vectors where I assumed the position components are in the w column. But if so that doesn't seem to line up with Direct3D or OpenGL according to my present understanding. Does HLSL not line up with either? If so I've never noticed so the conversion must be automatic.

    In conclusion I think I understand that everyone is converging on OpenGL's conventions. If so should I just find/replace pre/postmultiply and the parameters?


    EDITED: incidentally I think a lot of my confusion is probably from assuming Direct3D uses a different memory layout. I have used libraries in the past that use a transposed memory layout and I think I assumed they did so because Direct3D is popular and it was using a D3D layout. But now I am guessing those libraries were using a 3rd layout. Maybe for SIMD or something like in C (above) reasons.

    I really would like to figure out which convention conceptualizes the vector as a row as I think I would prefer to just stick with what is more C (language) friendly. As neither seems to follow textbooks.
    Last edited by michagl; 10-30-2012 at 12:55 PM.
    God have mercy on the soul that wanted hard decimal points and pure ctor conversion in GLSL.

Tags for this Thread

Posting Permissions

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