java – 在四边形OpenGL上重复纹理
作者:互联网
我正在写一个体素引擎
我正在研究Chunk-Rendering-System,但我遇到了问题.
似乎在四边形上重复了纹理.
草块底部有绿线,我不知道为什么.
这是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();
这是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.
标签:lwjgl,java,opengl,rendering,repeating 来源: https://codeday.me/bug/20190728/1562904.html