PDA

View Full Version : Vertex Transformation wiki page



brorep
01-15-2015, 12:36 PM
Hi,

While learning about vertex transformations I have found a page in the OpenGL wiki which explains them with numbers. I tried to reproduce them but failed. Then I checked using glGet functions and found that projection matrix shown on the page is wrong.

Since I am new to OpenGL can someone with more experience check the numbers on that page.

Page at OpenGl wiki: Vertex Transformation (https://www.opengl.org/wiki/Vertex_Transformation)

Projection matrix should be:

[ 10.00000, 0.00000, 0.00000, 0.00000 ]
[ 0.00000, 1.81818, 0.81818, 0.00000 ]
[ 0.00000, 0.00000, -1.00200, -2.00200 ]
[ 0.00000, 0.00000, -1.00000, 0.00000 ]


Is this correct?

Thank you

GClements
01-15-2015, 10:58 PM
Is this correct?
The matrix you give is correct for the glFrustum() call on the wiki page.

The matrix on the wiki page is correct for the call


glFrustum(-1.0, 0.1, -0.1, 0.1, 1.0, 1000.0)


Neither version seems to make much sense, one of the edges is at 45 degrees, while the other three are at 2.86 degrees. I.e. the projection is heavily off-centre with a fairly extreme aspect ratio.

I suspect that the first four values should have been either 0.1 or 1.0. Either would result in a centred projection with a 1:1 aspect ratio, but 0.1 is a rather narrow field of view (closer to telephoto zoom or sniper scope than to normal vision).

brorep
01-17-2015, 09:32 AM
Thanks,

If no one complains I will update wiki page with my results:

projection matrix:
[ 10.00000, 0.00000, 0.00000, 0.00000 ]
[ 0.00000, 1.81818, 0.81818, 0.00000 ]
[ 0.00000, 0.00000, -1.00200, -2.00200 ]
[ 0.00000, 0.00000, -1.00000, 0.00000 ]
model view matrix:
[ 1.00000, 0.00000, 0.00000, 1.00000 ]
[ 0.00000, 1.00000, 0.00000, 2.00000 ]
[ 0.00000, 0.00000, 1.00000, 3.00000 ]
[ 0.00000, 0.00000, 0.00000, 1.00000 ]
viewport:
[ 0.00000, 0.00000, 800.00000, 600.00000 ]
================================================== =====
vertex:
[ 1.50000, 1.60000, -99.60000, 1.00000 ]
eye space:
[ 2.50000, 3.60000, -96.60000, 1.00000 ]
clip coordinates:
[ 25.00000, -72.49090, 94.79139, 96.60000 ]
w inverse:
[ 0.0104 ]
normalized device coordinates:
[ 0.25880, -0.75042, 0.98128 ]
window coordinates:
[ 503.51965, 74.87299, 0.99064 ]
================================================== =====
vertex:
[ 1.50000, 1.60000, 5.00000, 1.00000 ]
eye space:
[ 2.50000, 3.60000, 8.00000, 1.00000 ]
clip coordinates:
[ 25.00000, 13.09091, -10.01802, -8.00000 ]
w inverse:
[ -0.1250 ]
normalized device coordinates:
[ -3.12500, -1.63636, 1.25225 ]
window coordinates:
[ -850.00000, -190.90906, 1.12613 ]
================================================== =====
vertex:
[ 1.50000, 1.60000, -1010.00000, 1.00000 ]
eye space:
[ 2.50000, 3.60000, -1007.00000, 1.00000 ]
clip coordinates:
[ 25.00000, -817.36353, 1007.01398, 1007.00000 ]
w inverse:
[ 0.0010 ]
normalized device coordinates:
[ 0.02483, -0.81168, 1.00001 ]
window coordinates:
[ 409.93048, 56.49548, 1.00001 ]