我試圖在我的世界中繪製一些四邊形,但這是我有的問題:http://imgur.com/DgnAqv1但它應該在每邊繪製三角形,所以總共應該有4個三角形,我不知道爲什麼這不是加工。OpenGL在我的世界中繪製四邊形奇怪地顯示
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glDepthMask(false);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glColor4f(0F, 0.5F, 0.8F, 1F);
GL11.glBegin(GL11.GL_QUADS);
GL11.glVertex3d(ep.posX - RenderManager.renderPosX, ep.posY + ep.height + 0.5D - RenderManager.renderPosY, ep.posZ - RenderManager.renderPosZ);
GL11.glVertex3d(ep.posX - RenderManager.renderPosX + 1, ep.posY - RenderManager.renderPosY, ep.posZ - RenderManager.renderPosZ);
GL11.glVertex3d(ep.posX - RenderManager.renderPosX, ep.posY - RenderManager.renderPosY, ep.posZ - RenderManager.renderPosZ + 1);
GL11.glVertex3d(ep.posX - RenderManager.renderPosX, ep.posY + ep.height + 0.5D - RenderManager.renderPosY, ep.posZ - RenderManager.renderPosZ);
GL11.glEnd();
GL11.glBegin(GL11.GL_QUADS);
GL11.glVertex3d(ep.posX - RenderManager.renderPosX, ep.posY + ep.height + 0.5D - RenderManager.renderPosY, ep.posZ - RenderManager.renderPosZ);
GL11.glVertex3d(ep.posX - RenderManager.renderPosX - 1, ep.posY - RenderManager.renderPosY, ep.posZ - RenderManager.renderPosZ);
GL11.glVertex3d(ep.posX - RenderManager.renderPosX, ep.posY - RenderManager.renderPosY, ep.posZ - RenderManager.renderPosZ - 1);
GL11.glVertex3d(ep.posX - RenderManager.renderPosX, ep.posY + ep.height + 0.5D - RenderManager.renderPosY, ep.posZ - RenderManager.renderPosZ);
GL11.glEnd();
GL11.glBegin(GL11.GL_QUADS);
GL11.glVertex3d(ep.posX - RenderManager.renderPosX, ep.posY + ep.height + 0.5D - RenderManager.renderPosY, ep.posZ - RenderManager.renderPosZ);
GL11.glVertex3d(ep.posX - RenderManager.renderPosX - 1, ep.posY - RenderManager.renderPosY, ep.posZ - RenderManager.renderPosZ);
GL11.glVertex3d(ep.posX - RenderManager.renderPosX, ep.posY - RenderManager.renderPosY, ep.posZ - RenderManager.renderPosZ + 1);
GL11.glVertex3d(ep.posX - RenderManager.renderPosX, ep.posY + ep.height + 0.5D - RenderManager.renderPosY, ep.posZ - RenderManager.renderPosZ);
GL11.glEnd();
GL11.glBegin(GL11.GL_QUADS);
GL11.glVertex3d(ep.posX - RenderManager.renderPosX, ep.posY + ep.height + 0.5D - RenderManager.renderPosY, ep.posZ - RenderManager.renderPosZ);
GL11.glVertex3d(ep.posX - RenderManager.renderPosX + 1, ep.posY - RenderManager.renderPosY, ep.posZ - RenderManager.renderPosZ);
GL11.glVertex3d(ep.posX - RenderManager.renderPosX, ep.posY - RenderManager.renderPosY, ep.posZ - RenderManager.renderPosZ - 1);
GL11.glVertex3d(ep.posX - RenderManager.renderPosX, ep.posY + ep.height + 0.5D - RenderManager.renderPosY, ep.posZ - RenderManager.renderPosZ);
GL11.glEnd();
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glDepthMask(true);
GL11.glPopMatrix();
請直接在問題中發佈代碼(每行由4個空格前綴)。 –
我試過了,它沒有工作,看起來很可怕。 – user2487095
我編輯了你的帖子。您可以使用'glTranslate(-RenderManager.renderPosX,-RenderManager.renderPosY,-RenderManager.renderPosZ)'而不是在每個頂點上手動應用翻譯來使代碼更清晰。 –