PDA

View Full Version : ortho projection in shader



alexandra
08-11-2005, 05:23 AM
hi,

i ve got a question about using ortho projection.
i write my shader programs in rendermonkey. now i ve tried to use an ortho projection instead of perspective projection.

perspective projection:
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;

i ve tried to replace the projection operation with an ortho matrix
far clipping plane at 1000
near clipping plane at 1
(default values in rendermonkey)

mat4 OrthoProjektion =
mat4(1.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, -2.0/999.0, -1001.0/999.0,
0.0, 0.0, 0.0, 1.0);

gl_Position = OrthoProjektion * (gl_ModelViewMatrix * gl_Vertex);

but that does not work and i dont know why. it looks like intense perspective projection. Maybe someone knows what to do. the next problem i can not just write in opengl code gl_Ortho because i am working with rendermonkey and i have no access to the opengl code.

hopefully someone has a good idea.

thanks alexandra