Use varyings for masks instead of overloading gl_TexCoord.

This commit is contained in:
Paul Chote
2015-09-28 18:58:36 +01:00
parent e819ff832b
commit d5fd8e5828
4 changed files with 25 additions and 11 deletions

View File

@@ -1,6 +1,9 @@
uniform vec2 Scroll;
uniform vec2 r1,r2; // matrix elements
varying vec4 TexCoord;
varying vec4 ChannelMask;
vec4 DecodeChannelMask( float x )
{
if (x > 0.0)
@@ -13,6 +16,6 @@ void main()
{
vec2 p = (gl_Vertex.xy - Scroll.xy)*r1 + r2;
gl_Position = vec4(p.x,p.y,0,1);
gl_TexCoord[0] = gl_MultiTexCoord0;
gl_TexCoord[1] = DecodeChannelMask(gl_MultiTexCoord0.w);
TexCoord = gl_MultiTexCoord0;
ChannelMask = DecodeChannelMask(gl_MultiTexCoord0.w);
}