X-Git-Url: https://git.lukelau.me/?p=opengl.git;a=blobdiff_plain;f=material.cpp;h=a1d44beb6d07929865ee5309b6916f4ab109d951;hp=85ff7d7ce803f4ebe9ecff8f10c6ae33775acadc;hb=45e43c5d0b6a1415185211128d82190fd19c3fe9;hpb=552379e4a7bc443158d3f6d080cc28d59608e09a diff --git a/material.cpp b/material.cpp index 85ff7d7..a1d44be 100644 --- a/material.cpp +++ b/material.cpp @@ -49,6 +49,15 @@ Material::Texture::Texture(const aiString fileName, const aiScene &scene) { glTexImage2D(GL_TEXTURE_2D, 0, img.internalFormat(), img.width(), img.height(), 0, img.format(), img.type(), img.data()); } + // magnifying - no bigger mipmap available, so use linear filtering + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + // minifying - use a linear blend of two mipmaps + // which are themselves filtered linearly + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + glGenerateMipmap(GL_TEXTURE_2D); }