Commit 48e7e0f6 authored by Christian Forfang's avatar Christian Forfang

Issue 62 (Google Code): use GL_RED instead of deprecated GL_ALPHA as 2D-texture's internalFormat

parent 05766ec3
......@@ -34,7 +34,7 @@ uniform sampler2D texture;
void main(void)
{
vec4 color = texture2D(texture, gl_TexCoord[0].st);
float dist = color.a;
float dist = color.r;
float width = fwidth(dist);
float alpha = smoothstep(0.5-width, 0.5+width, dist);
gl_FragColor = vec4(gl_Color.rgb, alpha*gl_Color.a);
......
......@@ -34,7 +34,7 @@ uniform sampler2D texture;
void main(void)
{
vec3 color = vec3(0.0,0.0,0.0);
float dist = texture2D(texture, gl_TexCoord[0].st).a;
float dist = texture2D(texture, gl_TexCoord[0].st).r;
float width = fwidth(dist);
float alpha = smoothstep(0.5-width, 0.5+width, dist);
gl_FragColor = vec4(color, alpha);
......
......@@ -40,7 +40,7 @@ const float glow_center = 1.25;
void main(void)
{
vec4 color = texture2D(texture, gl_TexCoord[0].st);
float dist = color.a;
float dist = color.r;
float width = fwidth(dist);
float alpha = smoothstep(glyph_center-width, glyph_center+width, dist);
......
......@@ -91,7 +91,7 @@ void main()
// LCD Off
if( pixel.z == 1.0)
{
float a = texture2D(texture, uv).a;
float a = texture2D(texture, uv).r;
gl_FragColor = gl_Color * pow( a, 1.0/vgamma );
return;
}
......
......@@ -33,6 +33,6 @@
uniform sampler2D texture;
void main()
{
float a = texture2D(texture, gl_TexCoord[0].xy).a;
float a = texture2D(texture, gl_TexCoord[0].xy).r;
gl_FragColor = vec4(gl_Color.rgb, gl_Color.a*a);
}
......@@ -338,8 +338,8 @@ texture_atlas_upload( texture_atlas_t * self )
}
else
{
glTexImage2D( GL_TEXTURE_2D, 0, GL_ALPHA, self->width, self->height,
0, GL_ALPHA, GL_UNSIGNED_BYTE, self->data );
glTexImage2D( GL_TEXTURE_2D, 0, GL_RED, self->width, self->height,
0, GL_RED, GL_UNSIGNED_BYTE, self->data );
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment