/usr/share/psychtoolbox-3/PsychOpenGL/PsychGLSLShaders/PremultipliedAlphaTextureShader.frag.txt is in psychtoolbox-3-common 3.0.11.20140816.dfsg1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 32 33 34 | /*
* File: PremultipliedAlphaTextureShader.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.
* The shader premultiplies the alpha value to the RGB channels, instead of
* outputting it to the alpha channel.
*
* (c) 2009 by Mario Kleiner, licensed under MIT license.
*
*/
#extension GL_ARB_texture_rectangle : enable
uniform sampler2DRect Image;
uniform vec4 Offset;
varying vec4 baseColor;
void main()
{
/* Read alpha channel value from standard texture coordinate set: */
float alpha = texture2DRect(Image, gl_TexCoord[0].st).a;
/* Read RGB color values from secondary texture coordinate set: */
vec3 rgb = texture2DRect(Image, gl_TexCoord[1].st).rgb;
/* Assemble back into RGBA quadruple with premultiplied alpha: */
vec4 rgba = vec4(rgb * alpha, 1.0);
/* ... and output to framebuffer, with proper modulation and offset applied: */
gl_FragColor = (baseColor * rgba) + Offset;
}
|