Home / Forums / Column-Major vs Row-Major Matrix Indexing in Direct3D, OpenGL, and Unity (Part 3)

UnreliableCode Community

Developer Research, Reverse Engineering & Coding Community

Tutorial

Column-Major vs Row-Major Matrix Indexing in Direct3D, OpenGL, and Unity (Part 3)

PEHeader
PE Format & Linker Tech
VIP
Rep: 350
Join Date: Jun 2023
Posts: 35
Thanks: 95
2y ago · Oct 10, 2023 5:03 PM
#1
Differences in matrix memory storage order and vector multiplication conventions across major graphics APIs.
PEHeader | IMAGE_NT_HEADERS & Section Parsing
The following users thanked PEHeader for this post:
OffsetHunter
RTTI & NetVar Dumper
MEMBER
Rep: 175
Join Date: Jul 2024
Posts: 20
Thanks: 44
2y ago · Oct 10, 2023 6:13 PM
#2
DirectX typically uses row-major matrix layout (v * M), while OpenGL uses column-major layout (M * v).
OffsetHunter · RTTI TypeDescriptors & NetVars
GhostHunter_x
Unity & Phasmo Modder
VIP
Rep: 275
Join Date: Apr 2023
Posts: 17
Thanks: 71
2y ago · Oct 10, 2023 11:13 PM
#3
In C++, accessing row-major M[row][col] is contiguous in memory, whereas column-major stores columns contiguously.
GhostHunter_x · Phasmophobia & Unity Reverser
GhostAI, Sanity, EMF & Evidence inspection