禁用 opengl es 纹理 ios
如何在渲染函数中暂时禁用 opengl es 2.x for ios 上的纹理? 我正在实施颜色选择。
我没有使用 glkit。我正在使用着色器,因此 glDisable(GL_TEXTURE_2D)
不起作用,glBindTexture(GL_TEXTURE_2D,0)
也不起作用
How do i temporarily disable textures on opengl es 2.x for ios in the render function?
I am implementing color selection.
I am not using glkit. I am using shaders, so glDisable(GL_TEXTURE_2D)
doesn't work, nor did glBindTexture(GL_TEXTURE_2D,0)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
取决于您想要实现什么目标。如果禁用纹理,您希望渲染中出现什么?
如果你的着色器根据纹理样本计算片段的颜色,如果你没有绑定任何纹理,它应该使用什么来代替纹理?一种颜色?
我看到 2 个选项:
A - 使用 2 个着色器,一个支持纹理,一个使用固定颜色(如果加载属性,则使用顶点颜色)
B - 使用单个着色器并使用统一来试行渲染(纹理或颜色)。
选项 B 提供了更高的性能。
编辑关于如何做到这一点的第一个问题:
Depends on what you want to achieve. If you disable a texture what do you expect to have in your rendering?
If your shader calculates the color of a fragment based on a Texture sample, if you do not bind any texture, what should it use in place of the texture? A color?
I see 2 options:
A - use 2 shaders, one supporting textures, one using fixed colors (or vertex colors if you load the attribute)
B - use a single shader and pilot the rendering (texture or colors) using uniforms.
The option B offers much more performance.
Edit to first question on how to do it: