Move the GL_UNPACK_ALIGNMENT setting into the texture creation, so that clients won...
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 13 Oct 2012 21:51:12 +0000 (23:51 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 13 Oct 2012 21:51:12 +0000 (23:51 +0200)
demo.cpp
flat_input.cpp
ycbcr_input.cpp

index 625dba6..0cc3c48 100644 (file)
--- a/demo.cpp
+++ b/demo.cpp
@@ -154,7 +154,6 @@ int main(int argc, char **argv)
        SDL_WM_SetCaption("OpenGL window", NULL);
        
        // geez 
        SDL_WM_SetCaption("OpenGL window", NULL);
        
        // geez 
-       glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
        glPixelStorei(GL_PACK_ALIGNMENT, 1);
 
        unsigned img_w, img_h;
        glPixelStorei(GL_PACK_ALIGNMENT, 1);
 
        unsigned img_w, img_h;
index 31800a7..b37a1ec 100644 (file)
@@ -85,6 +85,8 @@ void FlatInput::finalize()
        check_error();
        glBindTexture(GL_TEXTURE_2D, texture_num);
        check_error();
        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);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, needs_mipmaps ? GL_LINEAR_MIPMAP_NEAREST : GL_LINEAR);
        check_error();
        glPixelStorei(GL_UNPACK_ROW_LENGTH, pitch);
index 268abcb..8d58c7d 100644 (file)
@@ -49,6 +49,9 @@ YCbCrInput::~YCbCrInput()
 
 void YCbCrInput::finalize()
 {
 
 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();
        // Create PBOs to hold the textures holding the input image, and then the texture itself.
        glGenBuffers(3, pbos);
        check_error();