From c3be5c4682ec57032f2d0f8d145bd1f98afe7cb0 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Tue, 12 Nov 2019 21:27:46 -0400 Subject: [PATCH] Fix a crash when Canvas:newImageData is called and the width multiplied by the canvas format's pixel byte size is not a multiple of 4, for example a 3x3 r16f canvas (thanks Max!) --- src/modules/graphics/opengl/Graphics.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/modules/graphics/opengl/Graphics.cpp b/src/modules/graphics/opengl/Graphics.cpp index 3f457b235..15f50b8b1 100644 --- a/src/modules/graphics/opengl/Graphics.cpp +++ b/src/modules/graphics/opengl/Graphics.cpp @@ -191,6 +191,7 @@ bool Graphics::setMode(int width, int height, int pixelwidth, int pixelheight, b // Set pixel row alignment glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glPixelStorei(GL_PACK_ALIGNMENT, 1); // Always enable seamless cubemap filtering when possible. if (GLAD_VERSION_3_2 || GLAD_ARB_seamless_cube_map)