chlorinedreams

01-13-2008, 11:49 AM

I know this must be described somewhere, but I can't find it...

I need to be able to get the screen-space coordinates of a submitted vertex (in the Vertex or Fragment shaders) so I can generate a screen-space UV coordinate from it. I should be able to transform the vertex by multiplying it by gl_ModelViewProjectionMatrix * gl_Vertex or ftransform() correct?

Any attempt to project the vertex, gives me results that are close to the desired behaviour, but not stable. Is there a link anyone knows of that describes exactly what these transforms are supposed to produce?

Essentially I am trying to implement an "indirect texture lookup" solution with my deferred shader engine, to allow warping of previously rendered pixels.

// CD

I need to be able to get the screen-space coordinates of a submitted vertex (in the Vertex or Fragment shaders) so I can generate a screen-space UV coordinate from it. I should be able to transform the vertex by multiplying it by gl_ModelViewProjectionMatrix * gl_Vertex or ftransform() correct?

Any attempt to project the vertex, gives me results that are close to the desired behaviour, but not stable. Is there a link anyone knows of that describes exactly what these transforms are supposed to produce?

Essentially I am trying to implement an "indirect texture lookup" solution with my deferred shader engine, to allow warping of previously rendered pixels.

// CD