Java Opengl ES 3.0中的多文本和标签

Java Opengl ES 3.0中的多文本和标签,java,opengl-es,glsl,shader,opengl-es-3.0,Java,Opengl Es,Glsl,Shader,Opengl Es 3.0,我想用多重文本在一个对象上画数字。但最终的图像更轻,如: 是否可以从multitexure中排除白色并使数字变暗 以下是我的片段着色器: #version 300 es precision mediump float; in vec2 v_textureCoord; out vec4 outColor; uniform sampler2D base_texture; uniform sampler2D number_texture; void main() { // wall text

我想用多重文本在一个对象上画数字。但最终的图像更轻,如:

是否可以从multitexure中排除白色并使数字变暗

以下是我的片段着色器:

#version 300 es
precision mediump float;
in vec2 v_textureCoord;
out vec4 outColor;
uniform sampler2D base_texture;
uniform sampler2D number_texture;
void main() {
    // wall texture
    vec4 baseColor = texture(base_texture, v_textureCoord);
    // texture with digit
    vec4 numberColor = texture(number_texture, v_textureCoord);
    // resulting pixel color based on two textures 
    outColor = baseColor * (numberColor + 0.5);
}
我试着这样做:

GLES30.glEnable(GLES30.GL_BLEND);
GLES30.glBlendFunc(GLES30.GL_SRC_ALPHA, GLES30.GL_ONE);
GLES30.glActiveTexture(GLES30.GL_TEXTURE1);
...
GLES30.glDisable(GLES30.GL_BLEND);
但这并没有解决问题

谢谢你的回答/评论

解决方案: 根据拉比的建议,我采用了以下方法:

outColor = baseColor * mix(numberColor, vec4(1.0), 0.5);
结果:

number\u纹理的颜色设置为白色,而不是添加常量:

outColor=baseColor*mix(numberColor,vec4(1.0),0.5);
实际上,这与:

outColor=baseColor*(numberColor*0.5+0.5);