Skip to content

Commit 7061a2a

Browse files
authored
Merge pull request #9846 from Flarkk/shader_matrix_convention
Fix shader language matrix row/col convention
2 parents 8727b94 + 54f368c commit 7061a2a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tutorials/shaders/shader_reference/shading_language.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ Individual scalar members of vector types are accessed via the "x", "y", "z" and
163163
equivalent. Use whatever fits best for your needs.
164164

165165
For matrices, use the ``m[column][row]`` indexing syntax to access each scalar,
166-
or ``m[idx]`` to access a vector by row index. For example, for accessing the y
167-
position of an object in a mat4 you use ``m[3][1]``.
166+
or ``m[column]`` to access a vector by column index. For example, for accessing the
167+
y-component of the translation from a mat4 transform matrix (4th column, 2nd line) you use ``m[3][1]`` or ``m[3].y``.
168168

169169
Constructing
170170
~~~~~~~~~~~~
@@ -182,7 +182,7 @@ Construction of vector types must always pass:
182182
vec4 a = vec4(0.0);
183183
184184
Construction of matrix types requires vectors of the same dimension as the
185-
matrix. You can also build a diagonal matrix using ``matx(float)`` syntax.
185+
matrix, interpreted as columns. You can also build a diagonal matrix using ``matx(float)`` syntax.
186186
Accordingly, ``mat4(1.0)`` is an identity matrix.
187187

188188
.. code-block:: glsl

0 commit comments

Comments
 (0)