从片段着色器中删除纹理坐标
我有一个顶点和片段着色器,我想显示纯色而不是纹理。
我有以下顶点和片段着色器。
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); \
} \
";
我必须如何修改片段着色器才能不显示纹理? (对不起我的英语)。
谢谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
更改
为
它将绘制白色而不是纹理。
Change
to
It will draw white colour instead of the texture.