1
我無法在矩形多邊形上繪製紋理。LWJGL紋理對象 - Java
這是我目前的代碼。
texture.bind();
GL11.glBegin(GL11.GL_QUADS);
GL11.glColor3d(255, 255, 255);
//Top
GL11.glTexCoord2f(0,0); GL11.glVertex3f(x1, y1, z1);
GL11.glTexCoord2f(0,1); GL11.glVertex3f(x1+width, y1, z1);
GL11.glTexCoord2f(1,1); GL11.glVertex3f(x1+width, y1, z1+length);
GL11.glTexCoord2f(1,0); GL11.glVertex3f(x1, y1, z1+length);
GL11.glTexCoord3f(1, 1, 1);
//Bottom
GL11.glTexCoord2f(0,0); GL11.glVertex3f(x1, y1+height, z1);
GL11.glTexCoord2f(0,1); GL11.glVertex3f(x1+width, y1+height, z1);
GL11.glTexCoord2f(1,1); GL11.glVertex3f(x1+width, y1+height, z1+length);
GL11.glTexCoord2f(1,0); GL11.glVertex3f(x1, y1+height, z1+length);
//Front
GL11.glTexCoord2f(0,0); GL11.glVertex3f(x1, y1, z1);
GL11.glTexCoord2f(0,1); GL11.glVertex3f(x1+width, y1, z1);
GL11.glTexCoord2f(1,1); GL11.glVertex3f(x1+width, y1+height, z1);
GL11.glTexCoord2f(1,0); GL11.glVertex3f(x1, y1+height, z1);
//Back
GL11.glTexCoord2f(0,0); GL11.glVertex3f(x1, y1, z1+length);
GL11.glTexCoord2f(0,1); GL11.glVertex3f(x1+width, y1, z1+length);
GL11.glTexCoord2f(1,1); GL11.glVertex3f(x1+width, y1+height, z1+length);
GL11.glTexCoord2f(1,0); GL11.glVertex3f(x1, y1+height, z1+length);
//Left side
GL11.glTexCoord2f(0,0); GL11.glVertex3f(x1, y1, z1);
GL11.glTexCoord2f(0,1); GL11.glVertex3f(x1, y1, z1+length);
GL11.glTexCoord2f(1,1); GL11.glVertex3f(x1, y1+height, z1+length);
GL11.glTexCoord2f(1,0); GL11.glVertex3f(x1, y1+height, z1);
//Right side
GL11.glTexCoord2f(0,0); GL11.glVertex3f(x1+width, y1, z1);
GL11.glTexCoord2f(0,1); GL11.glVertex3f(x1+width, y1, z1+length);
GL11.glTexCoord2f(1,1); GL11.glVertex3f(x1+width, y1+height, z1+length);
GL11.glTexCoord2f(1,0); GL11.glVertex3f(x1+width, y1+height, z1);
GL11.glEnd();
它只是似乎並不只是薄薄的像塊周圍繪製。有誰知道我會如何解決這個問題?