1
我开始在openGl中使用纹理,并且我注意到了一些奇怪的行为。看到下面的伪代码示例:OpenGL:处理纹理时至少绑定一个纹理?
int main()...
bindTexture1();
bindTexture2();
bindTexture3();
// None of these textures are actually used!
while(true) {
begin();
// draw stuff
end();
}
Im加载和绑定3纹理,但现在我只是绘制原语。但是那些原始图像是不可见的。他们在以下情况下可见:
int main()...
bindTexture1(); // <- So the first bind() remains the only one
//bindTexture2();
//bindTexture3();
// None of these textures are actually used!
while(true) {
begin();
// draw again just primitve stuff but now it's visible
end();
}
或者
int main()...
bindTexture1();
bindTexture2();
bindTexture3();
// None of these textures are actually used!
while(true) {
begin();
bindTexture1(); // Binding texture 1 again
// draw again just primitve stuff but now it's visible
end();
}
所以我想我的问题是连接到这个glBindTexture功能?
glEnable质地只用于固定功能流水线。 – datenwolf 2013-02-27 14:43:28
这个答案解决了我的问题。如果使用glEnable(GL_TEXTURE_2D),是否有显着的速度差异;和glDisable(GL_TEXTURE_2D);更频繁?例如。为每个具有纹理的物体?或者我应该调用它,使用纹理渲染所有东西,并调用glDisable? – Anonymous 2013-02-27 14:56:09
@匿名号这将是一个微型优化 – 2013-02-27 19:49:18