15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci ARB_transpose_matrix 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_ARB_transpose_matrix 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciContact 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci David Blythe (blythe 'at' sgi.com) 125bd8deadSopenharmony_ci 135bd8deadSopenharmony_ciNotice 145bd8deadSopenharmony_ci 155bd8deadSopenharmony_ci Copyright (c) 1999-2013 The Khronos Group Inc. Copyright terms at 165bd8deadSopenharmony_ci http://www.khronos.org/registry/speccopyright.html 175bd8deadSopenharmony_ci 185bd8deadSopenharmony_ciSpecification Update Policy 195bd8deadSopenharmony_ci 205bd8deadSopenharmony_ci Khronos-approved extension specifications are updated in response to 215bd8deadSopenharmony_ci issues and bugs prioritized by the Khronos OpenGL Working Group. For 225bd8deadSopenharmony_ci extensions which have been promoted to a core Specification, fixes will 235bd8deadSopenharmony_ci first appear in the latest version of that core Specification, and will 245bd8deadSopenharmony_ci eventually be backported to the extension document. This policy is 255bd8deadSopenharmony_ci described in more detail at 265bd8deadSopenharmony_ci https://www.khronos.org/registry/OpenGL/docs/update_policy.php 275bd8deadSopenharmony_ci 285bd8deadSopenharmony_ciStatus 295bd8deadSopenharmony_ci 305bd8deadSopenharmony_ci Complete. Approved by ARB on 12/8/1999 315bd8deadSopenharmony_ci 325bd8deadSopenharmony_ciVersion 335bd8deadSopenharmony_ci 345bd8deadSopenharmony_ci Last Modified Date: January 3, 2000 355bd8deadSopenharmony_ci Author Revision: 1.3 365bd8deadSopenharmony_ci 375bd8deadSopenharmony_ciNumber 385bd8deadSopenharmony_ci 395bd8deadSopenharmony_ci ARB Extension #3 405bd8deadSopenharmony_ci 415bd8deadSopenharmony_ciDependencies 425bd8deadSopenharmony_ci 435bd8deadSopenharmony_ci This extensions is written against the OpenGL 1.2 Specification. 445bd8deadSopenharmony_ci May be implemented in any version of OpenGL. 455bd8deadSopenharmony_ci 465bd8deadSopenharmony_ciOverview 475bd8deadSopenharmony_ci 485bd8deadSopenharmony_ci New functions and tokens are added allowing application matrices 495bd8deadSopenharmony_ci stored in row major order rather than column major order to be 505bd8deadSopenharmony_ci transferred to the OpenGL implementation. This allows an application 515bd8deadSopenharmony_ci to use standard C-language 2-dimensional arrays (m[row][col]) and 525bd8deadSopenharmony_ci have the array indices match the expected matrix row and column indexes. 535bd8deadSopenharmony_ci These arrays are referred to as transpose matrices since they are 545bd8deadSopenharmony_ci the transpose of the standard matrices passed to OpenGL. 555bd8deadSopenharmony_ci 565bd8deadSopenharmony_ci This extension adds an interface for transfering data to and from the 575bd8deadSopenharmony_ci OpenGL pipeline, it does not change any OpenGL processing or imply any 585bd8deadSopenharmony_ci changes in state representation. 595bd8deadSopenharmony_ci 605bd8deadSopenharmony_ciIP Status 615bd8deadSopenharmony_ci 625bd8deadSopenharmony_ci No IP is believed to be involved. 635bd8deadSopenharmony_ci 645bd8deadSopenharmony_ciIssues 655bd8deadSopenharmony_ci 665bd8deadSopenharmony_ci * Why do this? 675bd8deadSopenharmony_ci 685bd8deadSopenharmony_ci It's very useful for layered libraries that desire to use two 695bd8deadSopenharmony_ci dimensional C arrays as matrices. It avoids having the layered 705bd8deadSopenharmony_ci library perform the transpose itself before calling OpenGL since 715bd8deadSopenharmony_ci most OpenGL implementations can efficiently perform the transpose 725bd8deadSopenharmony_ci while reading the matrix from client memory. 735bd8deadSopenharmony_ci 745bd8deadSopenharmony_ci * Why not add a mode? 755bd8deadSopenharmony_ci 765bd8deadSopenharmony_ci It's substantially more confusing and complicated to add a mode. 775bd8deadSopenharmony_ci Simply adding two new entry points saves considerable confusion 785bd8deadSopenharmony_ci and avoids having layered libraries need to query the current mode 795bd8deadSopenharmony_ci in order to send a matrix with the correct memory layout. 805bd8deadSopenharmony_ci 815bd8deadSopenharmony_ci * Why not a utility routine in GLU 825bd8deadSopenharmony_ci 835bd8deadSopenharmony_ci It costs some performance. It is believed that most OpenGL 845bd8deadSopenharmony_ci implementations can perform the transpose in place with negligble 855bd8deadSopenharmony_ci performance penalty. 865bd8deadSopenharmony_ci 875bd8deadSopenharmony_ci * Why use the name transpose? 885bd8deadSopenharmony_ci 895bd8deadSopenharmony_ci It's sure a lot less confusing than trying to ascribe unambiguous 905bd8deadSopenharmony_ci meaning to terms like row and column. It could be matrix_transpose 915bd8deadSopenharmony_ci rather than transpose_matrix though. 925bd8deadSopenharmony_ci 935bd8deadSopenharmony_ci * Short Transpose to Trans? 945bd8deadSopenharmony_ci 955bd8deadSopenharmony_ci 965bd8deadSopenharmony_ciNew Procedures and Functions 975bd8deadSopenharmony_ci 985bd8deadSopenharmony_ci void LoadTransposeMatrix{fd}ARB(T m[16]); 995bd8deadSopenharmony_ci void MultTransposeMatrix{fd}ARB(T m[16]); 1005bd8deadSopenharmony_ci 1015bd8deadSopenharmony_ciNew Tokens 1025bd8deadSopenharmony_ci 1035bd8deadSopenharmony_ci Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, 1045bd8deadSopenharmony_ci and GetDoublev 1055bd8deadSopenharmony_ci 1065bd8deadSopenharmony_ci TRANSPOSE_MODELVIEW_MATRIX_ARB 0x84E3 1075bd8deadSopenharmony_ci TRANSPOSE_PROJECTION_MATRIX_ARB 0x84E4 1085bd8deadSopenharmony_ci TRANSPOSE_TEXTURE_MATRIX_ARB 0x84E5 1095bd8deadSopenharmony_ci TRANSPOSE_COLOR_MATRIX_ARB 0x84E6 1105bd8deadSopenharmony_ci 1115bd8deadSopenharmony_ci 1125bd8deadSopenharmony_ciAdditions to Chapter 2 of the 1.2 OpenGL Specification (OpenGL Operation) 1135bd8deadSopenharmony_ci 1145bd8deadSopenharmony_ci Add to Section 2.10.2 Matrices <before LoadIdentity> 1155bd8deadSopenharmony_ci 1165bd8deadSopenharmony_ci LoadTransposeMatrixARB takes a 4x4 matrix stored in row-major order as 1175bd8deadSopenharmony_ci 1185bd8deadSopenharmony_ci Let transpose(m,n) be defined as 1195bd8deadSopenharmony_ci 1205bd8deadSopenharmony_ci n[0] = m[0]; 1215bd8deadSopenharmony_ci n[1] = m[4]; 1225bd8deadSopenharmony_ci n[2] = m[8]; 1235bd8deadSopenharmony_ci n[3] = m[12]; 1245bd8deadSopenharmony_ci n[4] = m[1]; 1255bd8deadSopenharmony_ci n[5] = m[5]; 1265bd8deadSopenharmony_ci n[6] = m[9]; 1275bd8deadSopenharmony_ci n[7] = m[13]; 1285bd8deadSopenharmony_ci n[8] = m[2]; 1295bd8deadSopenharmony_ci n[9] = m[6]; 1305bd8deadSopenharmony_ci n[10] = m[10]; 1315bd8deadSopenharmony_ci n[11] = m[14]; 1325bd8deadSopenharmony_ci n[12] = m[3]; 1335bd8deadSopenharmony_ci n[13] = m[7]; 1345bd8deadSopenharmony_ci n[14] = m[11]; 1355bd8deadSopenharmony_ci n[15] = m[15]; 1365bd8deadSopenharmony_ci 1375bd8deadSopenharmony_ci The effect of LoadTransposeMatrixARB(m) is then the same as the effect of 1385bd8deadSopenharmony_ci the command sequence 1395bd8deadSopenharmony_ci 1405bd8deadSopenharmony_ci float n[16]; 1415bd8deadSopenharmony_ci transpose(m,n) 1425bd8deadSopenharmony_ci LoadMatrix(n); 1435bd8deadSopenharmony_ci 1445bd8deadSopenharmony_ci The effect of MultTransposeMatrixARB(m) is then the same as the effect of 1455bd8deadSopenharmony_ci the command sequence 1465bd8deadSopenharmony_ci 1475bd8deadSopenharmony_ci float n[16]; 1485bd8deadSopenharmony_ci transpose(m,n); 1495bd8deadSopenharmony_ci MultMatrix(n); 1505bd8deadSopenharmony_ci 1515bd8deadSopenharmony_ci 1525bd8deadSopenharmony_ciAdditions to Chapter 3 of the 1.2 OpenGL Specification (Rasterization) 1535bd8deadSopenharmony_ci 1545bd8deadSopenharmony_ci None 1555bd8deadSopenharmony_ci 1565bd8deadSopenharmony_ciAdditions to Chapter 4 of the 1.2 OpenGL Specification (Per-Fragment Operations 1575bd8deadSopenharmony_ciand the Framebuffer) 1585bd8deadSopenharmony_ci 1595bd8deadSopenharmony_ci None 1605bd8deadSopenharmony_ci 1615bd8deadSopenharmony_ciAdditions to Chapter 5 of the 1.2 OpenGL Specification (Special Functions) 1625bd8deadSopenharmony_ci 1635bd8deadSopenharmony_ci None 1645bd8deadSopenharmony_ci 1655bd8deadSopenharmony_ciAdditions to Chapter 6 of the 1.2 OpenGL Specification (State and State Requests) 1665bd8deadSopenharmony_ci 1675bd8deadSopenharmony_ci Matrices are queried and returned in their transposed form by calling 1685bd8deadSopenharmony_ci GetBooleanv, GetIntegerv, GetFloatv, and GetDoublev with <pname> set to 1695bd8deadSopenharmony_ci TRANSPOSE_MODELVIEW_MATRIX_ARB, TRANSPOSE_PROJECTION_MATRIX_ARB, 1705bd8deadSopenharmony_ci TRANSPOSE_TEXTURE_MATRIX_ARB, or TRANSPOSE_COLOR_MATRIX_ARB. 1715bd8deadSopenharmony_ci The effect of GetFloatv(TRANSPOSE_MODELVIEW_MATRIX_ARB,m) is then the same 1725bd8deadSopenharmony_ci as the effect of the command sequence 1735bd8deadSopenharmony_ci 1745bd8deadSopenharmony_ci float n[16]; 1755bd8deadSopenharmony_ci GetFloatv(MODELVIEW_MATRIX_ARB,n); 1765bd8deadSopenharmony_ci transpose(n,m); 1775bd8deadSopenharmony_ci 1785bd8deadSopenharmony_ci Similar results occur for TRANSPOSE_PROJECTION_MATRIX_ARB, 1795bd8deadSopenharmony_ci TRANSPOSE_TEXTURE_MATRIX_ARB, and TRANSPOSE_COLOR_MATRIX_ARB. 1805bd8deadSopenharmony_ci 1815bd8deadSopenharmony_ci 1825bd8deadSopenharmony_ciAdditions to Appendix A of the OpenGL 1.2.1 Specification (Invariance) 1835bd8deadSopenharmony_ci 1845bd8deadSopenharmony_ci None 1855bd8deadSopenharmony_ci 1865bd8deadSopenharmony_ciAdditions to the GLX Specification 1875bd8deadSopenharmony_ci 1885bd8deadSopenharmony_ci None 1895bd8deadSopenharmony_ci 1905bd8deadSopenharmony_ciGLX Protocol 1915bd8deadSopenharmony_ci 1925bd8deadSopenharmony_ci LoadTransposeMatrix and MultTransposeMatrix are layered 1935bd8deadSopenharmony_ci on top of LoadMatrix and MultMatrix protocol 1945bd8deadSopenharmony_ci performing client-side translation. The Get commands 1955bd8deadSopenharmony_ci are passed over the wire as part of the generic Get 1965bd8deadSopenharmony_ci protocol with no translation required. 1975bd8deadSopenharmony_ci 1985bd8deadSopenharmony_ciErrors 1995bd8deadSopenharmony_ci 2005bd8deadSopenharmony_ci No new errors, but error behavoir is inherited by the commands 2015bd8deadSopenharmony_ci that the transpose commands are implemented on top of 2025bd8deadSopenharmony_ci (LoadMatrix, MultMatrix, and Get*). 2035bd8deadSopenharmony_ci 2045bd8deadSopenharmony_ciNew State 2055bd8deadSopenharmony_ci 2065bd8deadSopenharmony_ci None 2075bd8deadSopenharmony_ci 2085bd8deadSopenharmony_ci TRANSPOSE_*_MATRIX_ARB refer to the same state as their non-transposed 2095bd8deadSopenharmony_ci counterparts. 2105bd8deadSopenharmony_ci 2115bd8deadSopenharmony_ciNew Implementation Dependent State 2125bd8deadSopenharmony_ci 2135bd8deadSopenharmony_ci None 2145bd8deadSopenharmony_ci 2155bd8deadSopenharmony_ciRevision History 2165bd8deadSopenharmony_ci 2175bd8deadSopenharmony_ci * Revision 1.1 - initial draft (18 Mar 1999) 2185bd8deadSopenharmony_ci * Revision 1.2 - changed to use layered specification and ARB affix 2195bd8deadSopenharmony_ci (23 Nov 1999) 2205bd8deadSopenharmony_ci * Revision 1.3 - Minor tweaks to GLX protocol and Errors. (7 Dec 1999) 2215bd8deadSopenharmony_ci 2225bd8deadSopenharmony_ciConformance Testing 2235bd8deadSopenharmony_ci 2245bd8deadSopenharmony_ci Load and Multiply the modelview matrix (initialized to identity 2255bd8deadSopenharmony_ci each time) using LoadTransposeMatrixfARB and MultTransposeMatrixfARB 2265bd8deadSopenharmony_ci with the matrix: 2275bd8deadSopenharmony_ci 2285bd8deadSopenharmony_ci ( 1 2 3 4 ) 2295bd8deadSopenharmony_ci ( 5 6 7 8 ) 2305bd8deadSopenharmony_ci ( 9 10 11 12 ) 2315bd8deadSopenharmony_ci (13 14 15 16 ) 2325bd8deadSopenharmony_ci 2335bd8deadSopenharmony_ci and get the modelview matrix using TRANSPOSE_MODELVIEW_MATRIX_ARB and 2345bd8deadSopenharmony_ci validate that the matrix is correct. Get the matrix using 2355bd8deadSopenharmony_ci MODELVIEW_MATRIX and verify that it is the transpose of the above 2365bd8deadSopenharmony_ci matrix. Load and Multiply the modelview matrix using LoadMatrixf 2375bd8deadSopenharmony_ci and MultMatrixf with the above matrix and verify that the correct 2385bd8deadSopenharmony_ci matrix is on the modelview stack using gets of MODELVIEW_MATRIX 2395bd8deadSopenharmony_ci and TRANSPOSE_MODELVIEW_MATRIX_ARB. 240