Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
426 views
in Technique[技术] by (71.8m points)

java - LWJGL random lines inbenween shapes

I have random lines inbetween my quads in my game which I would like to remove:enter image description here

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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/


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...