LWJGL random lines inbenween shapes

℡╲_俬逩灬. 提交于 2019-12-13 09:48:10

问题


I have random lines inbetween my quads in my game which I would like to remove:

as you can see, there appear to be lines inbetween the cubes. Does anyone know how to remove them? I am using openGL.

Edit: What I mean is is there any OpenGL functions such as glEnable to fix this?


回答1:


I'm guessing you have all of your textures on on image?

Near the edge of the block, OpenGL is sampling nearby pixels to make it smooth, so on the edge of your dirt block you can see it slightly fading into a stone block

try the lwjgl version of this:

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)

(the above is in in c++)

This will give you the pixelated effect like minecraft

Take a look at this for some more info http://gregs-blog.com/2008/01/17/opengl-texture-filter-parameters-explained/



来源:https://stackoverflow.com/questions/10421726/lwjgl-random-lines-inbenween-shapes

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!