Opengl es 从片段着色器中移除纹理坐标

Opengl es 从片段着色器中移除纹理坐标,opengl-es,fragment-shader,vertex-shader,opengl-es-2.0,Opengl Es,Fragment Shader,Vertex Shader,Opengl Es 2.0,我有一个顶点和碎片着色器,我想显示纯色而不是纹理 我有下面的顶点和片段着色器 static const char* meshVertexShader = " \ \ attribute vec4 vertexPosition; \ attribute vec4 vertexNormal; \ attribute vec2 vertexTexCoord; \ \ varying vec2 texCoord; \ varying vec4 normal; \ \ uniform mat4 m

我有一个顶点和碎片着色器,我想显示纯色而不是纹理

我有下面的顶点和片段着色器

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); \
} \
";
如何修改片段着色器以不显示纹理?(对不起我的英语)

谢谢。

换衣服

gl_FragColor = texture2D(texSampler2D, texCoord);


它将绘制白色而不是纹理。

这显然也意味着,如果您愿意,您可以剪切对texCoord和texSampler2D的所有引用,但编译器可能会自动删除它们。
gl_FragColor = vec4(1,1,1,1);