File: SeparateAlphaTextureShader.vert.txt

package info (click to toggle)
psychtoolbox-3 3.0.9%2Bsvn2579.dfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 63,408 kB
  • sloc: ansic: 73,310; cpp: 11,139; objc: 3,129; sh: 1,669; python: 382; php: 272; makefile: 172; java: 113
file content (31 lines) | stat: -rw-r--r-- 1,058 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
 * File: SeparateAlphaTextureShader.frag.txt
 * Shader for drawing of textures where the alpha channel is looked up
 * separately from the RGB channels, i.e. RGB texel lookup uses texture
 * coordinates offset by given optional shift parameters.
 *
 * (c) 2009 by Mario Kleiner, licensed under MIT license.
 *		 
 */

/* Attributes passed from Screen(): See the ProceduralShadingAPI.m file for infos: */
attribute vec4 modulateColor;
attribute vec4 auxParameters0;

/* Information passed to the fragment shader: */
varying vec4   baseColor;

void main()
{
    /* Apply standard geometric transformations to patch: */
    gl_Position = ftransform();

    /* Don't pass real texture coordinates, but ones corrected for hardware offsets (-0.5,0.5) */
    gl_TexCoord[0] = (gl_TextureMatrix[0] * gl_MultiTexCoord0) + vec4(-0.5, 0.5, 0.0, 0.0);

    /* Apply offset to primary texcoords, then pass them as secondary texcoords set: */
    gl_TexCoord[1] = gl_TexCoord[0] + auxParameters0;

    /* Pass through modulateColor: */
    baseColor = modulateColor;
}