基本上我有一个渲染函数,它使用纹理绘制一个矩形:
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glShadeModel(GL_SMOOTH);
glEnable(GL_TEXTURE_2D);
glShadeModel(GL_SMOOTH);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
glBindTexture(GL_TEXTURE_2D, texture[0]);
glBegin(GL_QUADS);
{
glTexCoord2f(0, 0);
glVertex3f(points[0]->x, points[0]->y, 0);
glTexCoord2f(1, 0);
glVertex3f(points[1]->x, points[1]->y, 0);
glTexCoord2f(1, 1);
glVertex3f(points[2]->x, points[2]->y, 0);
glTexCoord2f(0, 1);
glVertex3f(points[3]->x, points[3]->y, 0);
}
glEnd();
glDisable(GL_TEXTURE_2D);
运行后可以看到纹理图,但是太暗了。另外,一开始,我可以在几分之一秒内看到它的正常颜色。
有谁知道如何修理它?