From d0de60dc33df75fbcacb53a09568b14d0fd48cb9 Mon Sep 17 00:00:00 2001 From: Mel Date: Mon, 12 Jun 2023 17:09:55 +0200 Subject: Multithreaded world generation with Perlin --- src/GFX/Texture.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/GFX/Texture.cpp') diff --git a/src/GFX/Texture.cpp b/src/GFX/Texture.cpp index f5474df..ef48631 100644 --- a/src/GFX/Texture.cpp +++ b/src/GFX/Texture.cpp @@ -13,6 +13,10 @@ Texture::Texture(const Image::RawImage& image) { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + // If this is not here, odd-numbered rows (like those in i.e. 5x5 textures) + // will begin at the incorrect byte, causing color artifacts. + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, image.width(), image.height(), 0, GL_RGB, GL_UNSIGNED_BYTE, image.raw()); glGenerateMipmap(GL_TEXTURE_2D); -- cgit 1.4.1