#5812 - Use refdef's coordinates when drawing to screen shadow fbo, and separate depth texture and screen texture coordinates in glsl shaders.

This commit is contained in:
James Canete 2012-12-06 01:55:45 +00:00
parent 736e1d5170
commit 374c551404
5 changed files with 33 additions and 32 deletions

View file

@ -6,15 +6,13 @@ uniform vec3 u_ViewLeft;
uniform vec3 u_ViewUp;
uniform vec4 u_ViewInfo; // zfar / znear
varying vec2 var_ScreenTex;
varying vec2 var_DepthTex;
varying vec3 var_ViewDir;
void main()
{
gl_Position = attr_Position;
//vec2 screenCoords = gl_Position.xy / gl_Position.w;
//var_ScreenTex = screenCoords * 0.5 + 0.5;
var_ScreenTex = attr_TexCoord0.xy;
vec2 screenCoords = attr_TexCoord0.xy * 2.0 - 1.0;
vec2 screenCoords = gl_Position.xy / gl_Position.w;
var_DepthTex = attr_TexCoord0.xy;
var_ViewDir = u_ViewForward + u_ViewLeft * -screenCoords.x + u_ViewUp * screenCoords.y;
}