Move the GL_GENERATE_MIPMAP setting to a less broken place.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 3 Oct 2012 22:16:49 +0000 (00:16 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 3 Oct 2012 22:16:49 +0000 (00:16 +0200)
effect_chain.cpp

index 7cc23ff..e728963 100644 (file)
@@ -272,6 +272,9 @@ void EffectChain::finalize()
        check_error();
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
        check_error();
+       // Intel/Mesa seems to have a broken glGenerateMipmap() for non-FBO textures, so do it here.
+       glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, phases[0].input_needs_mipmaps ? GL_TRUE : GL_FALSE);
+       check_error();
        glTexImage2D(GL_TEXTURE_2D, 0, internal_format, width, height, 0, format, GL_UNSIGNED_BYTE, NULL);
        check_error();
 
@@ -301,11 +304,6 @@ void EffectChain::render_to_screen(unsigned char *src)
        check_error();
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
        check_error();
-
-       // Intel/Mesa seems to have a broken glGenerateMipmap() for non-FBO textures, so do it here.
-       glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, phases[0].input_needs_mipmaps ? GL_TRUE : GL_FALSE);
-       check_error();
-
        glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, 0);
        check_error();