summary refs log tree commit diff
path: root/src/GFX/Texture.cpp
diff options
context:
space:
mode:
authorMel <einebeere@gmail.com>2023-06-12 17:09:55 +0200
committerMel <einebeere@gmail.com>2023-06-12 17:14:03 +0200
commitd0de60dc33df75fbcacb53a09568b14d0fd48cb9 (patch)
tree7aefdbb81f114552881834bd5b0d842bc2bdb691 /src/GFX/Texture.cpp
parent23b0bc4d1ddc9fad3c32e8257497ddd13ac6a155 (diff)
downloadmeowcraft-d0de60dc33df75fbcacb53a09568b14d0fd48cb9.tar.zst
meowcraft-d0de60dc33df75fbcacb53a09568b14d0fd48cb9.zip
Multithreaded world generation with Perlin
Diffstat (limited to 'src/GFX/Texture.cpp')
-rw-r--r--src/GFX/Texture.cpp4
1 files changed, 4 insertions, 0 deletions
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);