From af39090a8902411ffc0c89f296a0f8bde9229f60 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sat, 13 Oct 2012 23:51:12 +0200 Subject: [PATCH 1/1] Move the GL_UNPACK_ALIGNMENT setting into the texture creation, so that clients won't have to worry. --- demo.cpp | 1 - flat_input.cpp | 2 ++ ycbcr_input.cpp | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/demo.cpp b/demo.cpp index 625dba6..0cc3c48 100644 --- a/demo.cpp +++ b/demo.cpp @@ -154,7 +154,6 @@ int main(int argc, char **argv) SDL_WM_SetCaption("OpenGL window", NULL); // geez - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glPixelStorei(GL_PACK_ALIGNMENT, 1); unsigned img_w, img_h; diff --git a/flat_input.cpp b/flat_input.cpp index 31800a7..b37a1ec 100644 --- a/flat_input.cpp +++ b/flat_input.cpp @@ -85,6 +85,8 @@ void FlatInput::finalize() check_error(); glBindTexture(GL_TEXTURE_2D, texture_num); check_error(); + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + check_error(); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, needs_mipmaps ? GL_LINEAR_MIPMAP_NEAREST : GL_LINEAR); check_error(); glPixelStorei(GL_UNPACK_ROW_LENGTH, pitch); diff --git a/ycbcr_input.cpp b/ycbcr_input.cpp index 268abcb..8d58c7d 100644 --- a/ycbcr_input.cpp +++ b/ycbcr_input.cpp @@ -49,6 +49,9 @@ YCbCrInput::~YCbCrInput() void YCbCrInput::finalize() { + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + check_error(); + // Create PBOs to hold the textures holding the input image, and then the texture itself. glGenBuffers(3, pbos); check_error(); -- 2.39.2