<分区>
Possible Duplicate:
Making redundant OpenGL calls
假设我有一个 Image
类,它有一个名为 draw
的方法,它在屏幕上绘制图像的一部分,并且还存储一个二维纹理的句柄包含实际图像数据。
这样实现draw()方法可以吗?
// ix, iy, w and h specify which part of the image to draw
void Image::draw(int x, int y, int ix, int iy, int w, int h)
{
glBindTexture(GL_TEXTURE_2D, m_textureHandle);
//and then draw the specified part of the image
}
这里我主要关心的是对 glBindTexture
的调用。假设如果纹理已经绑定(bind),此调用不会导致某种性能下降是否正确?