我对纹理和 OpenGL 有一点问题。我做了一个小的 .obj 加载器(带有纹理加载),但一切都被绘制成蓝色。例子:
我加载一个纹理。我用 GL11.glBindTexture(GL11.GL_TEXTURE_2D,textureId) 绑定纹理。如果我做:
glColor3f(1f,1f,1f);
glBegin(GL_QUADS);
glVertex3f(50f,0,-50);
glVertex3f(-50f,0,-50f);
glVertex3f(-50f,0,50f);
glVertex3f(50f,0,50f);
glEnd();
GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureId);
它画了一个白色的四边形......但如果我这样做:
GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureId);
glColor3f(1f,1f,1f);
glBegin(GL_QUADS);
glVertex3f(50f,0,-50);
glVertex3f(-50f,0,-50f);
glVertex3f(-50f,0,50f);
glVertex3f(50f,0,50f);
glEnd();
它绘制了一个蓝色四边形,其他所有内容也是蓝色的。
也许有人知道解决方案?