| 1 0 0 0 |
| 0 1 0 0 |
| 0 0 0 1/focus |
| 0 0 -1 0 |
M_P
| 1 0 0 0 |
| 0 1 0 0 |
| 0 0 0 1/focus |
| 0 0 -1 0 |
v
| x |
| y |
| z |
| 1 |
| x |
| y |
| -1 |
| z/focus |
// shouldn't it be :
| x |
| y |
| 1/focus |
| -z |
// ?
| 1 0 0 0 |
| 0 1 0 0 |
| 0 0 0 1/focus |
| 0 0 -1 0 |
M_P
| 1 0 0 0 |
| 0 1 0 0 |
| 0 0 0 1/focus |
| 0 0 -1 0 |
v
| x |
| y |
| z |
| 1 |
| x |
| y |
| -1 |
| z/focus |
// shouldn't it be :
| x |
| y |
| 1/focus |
| -z |
// ?
float mat4[16] = { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1/focus, 0, 0, -1, 0}
Quote:
By Enigma
Is this example in matrix algebra or C code? If it's in C code then this is correct, since OpenGL uses column-major matrices, not row-major matrices, so the matrix defined by:
float mat4[16] = {
1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 0, 1/focus,
0, 0, -1, 0
}
is actually the matrix:
1 0 0 0
0 1 0 0
0 0 0 -1
0 0 1/focus 0
Enigma