Clip Space coordinate question
In a vertex shader, after transforming by the MVP matrix - eg.
gl_Position = gl_ProjectionMatrix * cameraModelViewMatrix * gl_ModelViewMatrix * gl_Vertex;
(I have the camera transform separate from gl_ModelViewMatrix)
The values of gl_Position are mapped to a unit cube, correct? e.g. -1 < x,y,z < 1
I am trying to implement the effect of draping a texture over everything - basically like a projective texture or shadow map.
I thought I could use the x and y coords of
gl_lightPosition = lightProjectionMatrix * lightModelViewMatrix * gl_ModelViewMatrix * gl_Vertex
as the s,t indices into the texture.
But it seems to wrap the texture.
Any feedback/advice is appreciated...