5argon
5argon

Reputation: 3863

How to understand OpenGL documentation's matrix?

I'm sure my browser is not broken, but OpenGL's reference documentation uses very weird and undocumented matrix representation that I could not understand.

For example, this : https://www.opengl.org/sdk/docs/man2/xhtml/glFrustum.xml

Description

glFrustum describes a perspective matrix that produces a perspective projection. The current matrix (see glMatrixMode) is multiplied by this matrix and the result replaces the current matrix, as if glMultMatrix were called with the following matrix as its argument:

2 ⁢ nearVal right - left 0 A 0 0 2 ⁢ nearVal top - bottom B 0 0 0 C D 0 0 -1 0

A = right + left right - left

B = top + bottom top - bottom

C = - farVal + nearVal farVal - nearVal

D = - 2 ⁢ farVal ⁢ nearVal farVal - nearVal

So I cannot make sense of the "following matrix" they said. It doesn't even have 16 values if I have to look at it like linear array.

This is even harder : https://www.opengl.org/sdk/docs/man2/xhtml/glMultMatrix.xml

Examples

If the current matrix is C and the coordinates to be transformed are v = v ⁡ 0 v ⁡ 1 v ⁡ 2 v ⁡ 3 , then the current transformation is C × v , or

c ⁡ 0 c ⁡ 4 c ⁡ 8 c ⁡ 12 c ⁡ 1 c ⁡ 5 c ⁡ 9 c ⁡ 13 c ⁡ 2 c ⁡ 6 c ⁡ 10 c ⁡ 14 c ⁡ 3 c ⁡ 7 c ⁡ 11 c ⁡ 15 × v ⁡ 0 v ⁡ 1 v ⁡ 2 v ⁡ 3
Calling glMultMatrix with an argument of m = m ⁡ 0 m ⁡ 1 ... m ⁡ 15 replaces the current transformation with C × M × v , or

c ⁡ 0 c ⁡ 4 c ⁡ 8 c ⁡ 12 c ⁡ 1 c ⁡ 5 c ⁡ 9 c ⁡ 13 c ⁡ 2 c ⁡ 6 c ⁡ 10 c ⁡ 14 c ⁡ 3 c ⁡ 7 c ⁡ 11 c ⁡ 15 × m ⁡ 0 m ⁡ 4 m ⁡ 8 m ⁡ 12 m ⁡ 1 m ⁡ 5 m ⁡ 9 m ⁡ 13 m ⁡ 2 m ⁡ 6 m ⁡ 10 m ⁡ 14 m ⁡ 3 m ⁡ 7 m ⁡ 11 m ⁡ 15 × v ⁡ 0 v ⁡ 1 v ⁡ 2 v ⁡ 3
Where v is represented as a 4 × 1 matrix.

Upvotes: 1

Views: 97

Answers (2)

Nicol Bolas
Nicol Bolas

Reputation: 474316

The problem in your case is two-fold:

1: You have a browser which does not support MathML. The OpenGL 2.x documentation makes it clear that this is necessary.

2: The OpenGL 2.x documentation has not been updated with MathJax support, which enables MathML everywhere. The modern OpenGL 4.x documentation uses this, but that only covers the core profile stuff.

So there's no real solution for you, outside of getting a browser with MathML support. The Khronos Group has made it abundantly clear that they're not even going to fix wrong information in the man2 pages, let alone upgrade them with MathJax.

Upvotes: 3

datenwolf
datenwolf

Reputation: 162327

Does your browser support MathML? Because without it will show this unformatted mess. This is how it looks in a browser supporting MathML:

enter image description here

Upvotes: 3

Related Questions