|
|
@@ -155,14 +155,14 @@ static const string default_vshader =
|
|
|
"attribute vec4 p3d_Color;\n"
|
|
|
"attribute vec2 p3d_MultiTexCoord0;\n"
|
|
|
"varying vec2 texcoord;\n"
|
|
|
- "varying vec4 color;\n"
|
|
|
+ "varying lowp vec4 color;\n"
|
|
|
#endif
|
|
|
"uniform mat4 p3d_ModelViewProjectionMatrix;\n"
|
|
|
"uniform vec4 p3d_ColorScale;\n"
|
|
|
"void main(void) {\n"
|
|
|
" gl_Position = p3d_ModelViewProjectionMatrix * p3d_Vertex;\n"
|
|
|
" texcoord = p3d_MultiTexCoord0;\n"
|
|
|
- " color = p3d_Color * p3d_ColorScale;\n"
|
|
|
+ " color = p3d_Color;\n"
|
|
|
"}\n";
|
|
|
|
|
|
static const string default_fshader =
|
|
|
@@ -171,18 +171,23 @@ static const string default_fshader =
|
|
|
"in vec2 texcoord;\n"
|
|
|
"in vec4 color;\n"
|
|
|
"out vec4 p3d_FragColor;"
|
|
|
+ "uniform sampler2D p3d_Texture0;\n"
|
|
|
+ "uniform vec4 p3d_TexAlphaOnly;\n"
|
|
|
#else
|
|
|
"precision mediump float;\n"
|
|
|
"varying vec2 texcoord;\n"
|
|
|
- "varying vec4 color;\n"
|
|
|
+ "varying lowp vec4 color;\n"
|
|
|
+ "uniform lowp sampler2D p3d_Texture0;\n"
|
|
|
+ "uniform lowp vec4 p3d_TexAlphaOnly;\n"
|
|
|
#endif
|
|
|
- "uniform sampler2D p3d_Texture0;\n"
|
|
|
"void main(void) {\n"
|
|
|
#ifndef OPENGLES
|
|
|
" p3d_FragColor = texture(p3d_Texture0, texcoord);\n"
|
|
|
- " p3d_FragColor *= color;\n"
|
|
|
+ " p3d_FragColor += p3d_TexAlphaOnly;\n" // Hack for text rendering
|
|
|
+ " p3d_FragColor = color;\n"
|
|
|
#else
|
|
|
" gl_FragColor = texture2D(p3d_Texture0, texcoord).bgra;\n"
|
|
|
+ " gl_FragColor += p3d_TexAlphaOnly;\n" // Hack for text rendering
|
|
|
" gl_FragColor *= color;\n"
|
|
|
#endif
|
|
|
"}\n";
|
|
|
@@ -11549,9 +11554,9 @@ upload_texture(CLP(TextureContext) *gtc, bool force, bool uses_mipmaps) {
|
|
|
// texture formats?
|
|
|
switch (tex->get_format()) {
|
|
|
case Texture::F_alpha:
|
|
|
- glTexParameteri(target, GL_TEXTURE_SWIZZLE_R, GL_ONE);
|
|
|
- glTexParameteri(target, GL_TEXTURE_SWIZZLE_G, GL_ONE);
|
|
|
- glTexParameteri(target, GL_TEXTURE_SWIZZLE_B, GL_ONE);
|
|
|
+ glTexParameteri(target, GL_TEXTURE_SWIZZLE_R, GL_ZERO);
|
|
|
+ glTexParameteri(target, GL_TEXTURE_SWIZZLE_G, GL_ZERO);
|
|
|
+ glTexParameteri(target, GL_TEXTURE_SWIZZLE_B, GL_ZERO);
|
|
|
glTexParameteri(target, GL_TEXTURE_SWIZZLE_A, GL_RED);
|
|
|
break;
|
|
|
|