To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.off-topic.debateOpen lugnet.off-topic.debate in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Off-Topic / Debate / 28599
28598  |  28600
Subject: 
Re: OpenGL spec (was LDraw File Format spec)
Newsgroups: 
lugnet.off-topic.debate
Date: 
Thu, 23 Aug 2007 19:21:15 GMT
Viewed: 
10716 times
  
In lugnet.cad, William Howard wrote:
In lugnet.cad, Rob Ross wrote:
page 23

Vertex Arrays

"Matrices are loaded into these slots in column major order."

  Like I said before, the DOCS were written with column major notation but the
API isn't column major. Please show me a place on the API where it requires a
column major matrices, there isn't one.

  OpenGL matrices are simply an array of 16 floats, and a column major or a row
major matrix will have the same memory layout so they can both be passed to
OpenGL the same way. For example, LeoCAD uses row major matrices and passes them
to OpenGL directly.

  If you want to quote the OpenGL guide, let me quote one of the lead developers
from the OpenGL team (Mark Segal):

"To say without qualification that 'OpenGL stores matrices this way' is
technically nonsense. OpenGL does nothing. OpenGL DOCUMENTATION assumes that
vectors are columns therefore implying that matrices are given column major, but
you are free to take the alternate interpretation if you wish. It is also
nonsense to say that the hardware (or an OpenGL implementation) 'premultiples'
or 'postmultiplies' (I could never remember which was which anyway). OpenGL
applies a matrix (representing a transformation) to a series of coordinates
(representing a vector) using the rules of matrix multiplication. You may view
this as performing the multiplication c' = Mc, where c and c' are columns, or as
r' = rM(transpose) where r and r' are rows (and r=c(transpose) and
r'=c'(transpose) ). The two formulas represent the same calculation."

  Or if you want the OpenGL FAQ:

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.



Message is in Reply To:
  Re: OpenGL spec (was LDraw File Format spec)
 
(...) As this thread is for the discussion of the LDraw specification can any further debate of what the OpenGL specification may or may not say please be continued on .off-topic.debate Thanks William (17 years ago, 23-Aug-07, to lugnet.cad)

55 Messages in This Thread:


















Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR