diff options
author | Benjamin Otte <otte@redhat.com> | 2021-10-09 05:25:05 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2021-10-09 05:25:41 +0200 |
commit | d4959a95c21e20da530a0358f81049e13623d866 (patch) | |
tree | a768b3330b07a4d83f38769cb1ed0207d88e1ff2 | |
parent | 780ae5232dc24d37a70e1ae57a4e58d108af9d17 (diff) | |
download | gtk+-d4959a95c21e20da530a0358f81049e13623d866.tar.gz |
gl: Make sure to set a proper alignment
No matter which branch we take, the alignment setting is always the
same.
-rw-r--r-- | gdk/gdkglcontext.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/gdk/gdkglcontext.c b/gdk/gdkglcontext.c index 196e5fce4d..f719da3aea 100644 --- a/gdk/gdkglcontext.c +++ b/gdk/gdkglcontext.c @@ -298,15 +298,14 @@ gdk_gl_context_upload_texture (GdkGLContext *context, bpp = gdk_memory_format_bytes_per_pixel (data_format); + glPixelStorei (GL_UNPACK_ALIGNMENT, gdk_memory_format_alignment (data_format)); + /* GL_UNPACK_ROW_LENGTH is available on desktop GL, OpenGL ES >= 3.0, or if * the GL_EXT_unpack_subimage extension for OpenGL ES 2.0 is available */ if (stride == width * bpp) { - glPixelStorei (GL_UNPACK_ALIGNMENT, 1); - glTexImage2D (texture_target, 0, gl_internalformat, width, height, 0, gl_format, gl_type, data); - glPixelStorei (GL_UNPACK_ALIGNMENT, 4); } else if (stride % bpp == 0 && (!gdk_gl_context_get_use_es (context) || @@ -325,6 +324,7 @@ gdk_gl_context_upload_texture (GdkGLContext *context, for (i = 0; i < height; i++) glTexSubImage2D (texture_target, 0, 0, i, width, 1, gl_format, gl_type, data + (i * stride)); } + glPixelStorei (GL_UNPACK_ALIGNMENT, 4); g_free (copy); } |