View Full Version : Shader Centric Projection Rejection

02-05-2014, 02:08 AM
Is it reasonable for exploration purposes to construct a
projection matrix
within the vertex shader? My projection gets a rejection during rendering.
My projection matrix does not meet my expection during rendering. It does something. I just cannot tell what.
Am I missing some obvious pieces of the opengl picture?
I am trying to see how expressive the shader can be. So I am transforming there.

glutInitContextVersion(4, 2); Show_GL_Error();
glutInitContextProfile(GLUT_FORWARD_COMPATIBLE); //Show_GL_Error();

//vertex shader
mat4 perspective =
{(2 *near)/(right - left), 0,0,0},
{0, (2 * near)/(top-bottom), 0,0},
{2*(right+left)/(right-left),2*(top+bottom)/(top-bottom), -(far + near)/(far-near), -1},
this works for rotation
gl_Position = trans * scale * roty * vPosition;
this gives me unexpected results
gl_Position = perspective * trans * scale * roty * vPosition;
What does work
Viewing and rotating various meshes exported from Blender 3D.