Skip to content

Instantly share code, notes, and snippets.

@tai-fukaya
Created February 28, 2017 06:27
Show Gist options
  • Save tai-fukaya/f09325cd5ff45c5de03e90db8deab196 to your computer and use it in GitHub Desktop.
Save tai-fukaya/f09325cd5ff45c5de03e90db8deab196 to your computer and use it in GitHub Desktop.
2枚の画像を合成するシェーダー(上の画像に依存)
#version 120
uniform sampler2DRect tex0;
uniform sampler2DRect foreground;
varying vec2 texCoordVarying;
void main()
{
vec4 bgtex = texture2DRect(tex0, texCoordVarying);
vec4 fgtex = texture2DRect(foreground, texCoordVarying);
gl_FragColor = bgtex * (1.0 - fgtex.a) + fgtex * fgtex.a;
}
#version 120
varying vec2 texCoordVarying;
void main()
{
texCoordVarying = gl_MultiTexCoord0.xy;
gl_Position = ftransform();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment