草块底部有一条绿线,我不知道为什么.这是OpenGL渲染代码:Texture texture = TextureManager.getTexture(block.getTextureNameForSide(Direction.UP));texture.bind();GL11.glBegin(GL11.GL_QUADS);GL11.glTexCoord2d(0, 0); GL11.glVertex3f(0, 1, 0);GL11.glTexCoord2d(1, 0); GL11.glVertex3f(0, 1, 1);GL11.glTexCoord2d(1, 1); GL11.glVertex3f(1, 1, 1);GL11.glTexCoord2d(0, 1); GL11.glVertex3f(1, 1, 0);GL11.glEnd();这是OpenGL设置:GL11.glEnable(GL11.GL_TEXTURE_2D);GL11.glShadeModel(GL11.GL_SMOOTH);GL11.glClearColor(0.1F, 0.4F, 0.6F, 0F);GL11.glClearDepth(1F);GL11.glEnable(GL11.GL_DEPTH_TEST);GL11.glDepthFunc(GL11.GL_LEQUAL);GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);GL11.glCullFace(GL11.GL_BACK);GL11.glEnable(GL11.GL_CULL_FACE);解决方案确保将GL_TEXTURE_WRAP_S和GL_TEXTURE_WRAP_T设置为GL_CLAMP_TO_EDGE.I am writing a voxel engine and at the momentI am working on the Chunk-Rendering-System but I have a problem.It seems that the textures were repeated on the quads. There is this green line at the bottom of the grass blocks and I don't know why.This is the OpenGL-Render-Code:Texture texture = TextureManager.getTexture(block.getTextureNameForSide(Direction.UP));texture.bind();GL11.glBegin(GL11.GL_QUADS);GL11.glTexCoord2d(0, 0); GL11.glVertex3f(0, 1, 0);GL11.glTexCoord2d(1, 0); GL11.glVertex3f(0, 1, 1);GL11.glTexCoord2d(1, 1); GL11.glVertex3f(1, 1, 1);GL11.glTexCoord2d(0, 1); GL11.glVertex3f(1, 1, 0);GL11.glEnd();And here is the OpenGL-Setup:GL11.glEnable(GL11.GL_TEXTURE_2D);GL11.glShadeModel(GL11.GL_SMOOTH);GL11.glClearColor(0.1F, 0.4F, 0.6F, 0F);GL11.glClearDepth(1F);GL11.glEnable(GL11.GL_DEPTH_TEST);GL11.glDepthFunc(GL11.GL_LEQUAL);GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);GL11.glCullFace(GL11.GL_BACK);GL11.glEnable(GL11.GL_CULL_FACE); 解决方案 Make sure GL_TEXTURE_WRAP_S and GL_TEXTURE_WRAP_T are set to GL_CLAMP_TO_EDGE. 这篇关于在Quads OpenGL上重复纹理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-23 06:42