Reputation: 45921
I have a vertex and fragment shader and I want to show a solid color instead of a texture.
I have the following vertex and fragment shader.
static const char* meshVertexShader = " \
\
attribute vec4 vertexPosition; \
attribute vec4 vertexNormal; \
attribute vec2 vertexTexCoord; \
\
varying vec2 texCoord; \
varying vec4 normal; \
\
uniform mat4 modelViewProjectionMatrix; \
\
void main() \
{ \
gl_Position = modelViewProjectionMatrix * vertexPosition; \
normal = vertexNormal; \
texCoord = vertexTexCoord; \
} \
";
static const char* fragmentShader = " \
\
precision mediump float; \
\
varying vec2 texCoord; \
varying vec4 normal; \
\
uniform sampler2D texSampler2D; \
\
void main() \
{ \
gl_FragColor = texture2D(texSampler2D, texCoord); \
} \
";
How can I must modify fragment shader to not show a texture? (sorry for my english).
Thanks.
Upvotes: 1
Views: 881
Reputation: 72261
Change
gl_FragColor = texture2D(texSampler2D, texCoord);
to
gl_FragColor = vec4(1,1,1,1);
It will draw white colour instead of the texture.
Upvotes: 3