mesa: Branch 'master'

Ian Romanick idr at kemper.freedesktop.org
Sat Apr 21 17:53:13 UTC 2007


 progs/demos/shadowtex.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

New commits:
diff-tree ad3cc95485c488e3920f9c460b373338043000c5 (from 4e0a64675cbd815f6063977f3effbf21acced3fe)
Author: Ian Romanick <idr at us.ibm.com>
Date:   Sat Apr 21 10:47:54 2007 -0700

    Fix FBO completeness bug in shadowtex.

diff --git a/progs/demos/shadowtex.c b/progs/demos/shadowtex.c
index b32fb45..b11c6f5 100644
--- a/progs/demos/shadowtex.c
+++ b/progs/demos/shadowtex.c
@@ -296,14 +296,27 @@ RenderShadowMap(void)
              0, 1, 0); /* up */
 
    if (UseFBO) {
+      GLenum fbo_status;
+
       glTexImage2D(GL_TEXTURE_2D, 0, depthFormat,
                    ShadowTexWidth, ShadowTexHeight, 0,
                    depthFormat, depthType, NULL);
+
+      /* Set the filter mode so that the texture is texture-complete.
+       * Otherwise it will cause the framebuffer to fail the framebuffer
+       * completeness test.
+       */
+      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+
       glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, ShadowFBO);
       glDrawBuffer(GL_NONE);
       glReadBuffer(GL_NONE);
-      assert(glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT)
-             == GL_FRAMEBUFFER_COMPLETE_EXT);
+
+      fbo_status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
+      if (fbo_status != GL_FRAMEBUFFER_COMPLETE_EXT) {
+         fprintf(stderr, "FBO not complete!  status = 0x%04x\n", fbo_status);
+         assert(fbo_status == GL_FRAMEBUFFER_COMPLETE_EXT);
+      }
    }
 
    assert(!glIsEnabled(GL_TEXTURE_1D));



More information about the mesa-commit mailing list