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