user3346126
user3346126

Reputation: 3

OpenGL Graphics Artifacts

I'm having some graphics artifacts in OpenGL (I'm using LWJGL) that are shown in the image below. I've no clue how it's called exactly so I had hard time searching for the solution. https://i.sstatic.net/ihzlJ.png

Those are textured quads, but it's same with models and other kinds of primitives. Antialiasing is helping it only a bit. I'm sorry that I have to post that, probably there were lot of questions about it but I can't find anything.

Upvotes: 0

Views: 147

Answers (1)

Dan
Dan

Reputation: 1486

You need to load the texture using mipmap, see and example below:

// When MAGnifying the image (no bigger mipmap available), use LINEAR filtering
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
// When MINifying the image, use a LINEAR blend of two mipmaps, each filtered LINEARLY too
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
// Generate mipmaps, by the way.
glGenerateMipmap(GL_TEXTURE_2D);

There are quite a lot of tutorials about this online.

Upvotes: 2

Related Questions