Revision: 49014
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49014
Author:   moguri
Date:     2012-07-18 05:51:44 +0000 (Wed, 18 Jul 2012)
Log Message:
-----------
Fix for [#32129] "2D filter texture width off by one?" reported by Alex Fraser 
(z0r).

The GetWidth() and GetHeight() functions of the canvas' display area seem to 
give values that are both off by one for what OpenGL wants. Adding 1 to both 
values seems to fix the problem.

Modified Paths:
--------------
    trunk/blender/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp

Modified: trunk/blender/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp
===================================================================
--- trunk/blender/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp  
2012-07-18 05:40:24 UTC (rev 49013)
+++ trunk/blender/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp  
2012-07-18 05:51:44 UTC (rev 49014)
@@ -324,8 +324,8 @@
 void RAS_2DFilterManager::UpdateOffsetMatrix(RAS_ICanvas* canvas)
 {
        /* RAS_Rect canvas_rect = canvas->GetWindowArea(); */ /* UNUSED */
-       texturewidth = canvas->GetWidth();
-       textureheight = canvas->GetHeight();
+       texturewidth = canvas->GetWidth()+1;
+       textureheight = canvas->GetHeight()+1;
        GLint i,j;
 
        if (!GL_ARB_texture_non_power_of_two)
@@ -402,6 +402,7 @@
        GLuint  viewport[4]={0};
        glGetIntegerv(GL_VIEWPORT,(GLint *)viewport);
        RAS_Rect rect = canvas->GetWindowArea();
+       int rect_width = rect.GetWidth()+1, rect_height = rect.GetHeight()+1;
 
        if (canvaswidth != canvas->GetWidth() || canvasheight != 
canvas->GetHeight())
        {
@@ -419,19 +420,19 @@
        if (need_depth) {
                glActiveTextureARB(GL_TEXTURE1);
                glBindTexture(GL_TEXTURE_2D, texname[1]);
-               glCopyTexImage2D(GL_TEXTURE_2D,0,GL_DEPTH_COMPONENT, 
rect.GetLeft(), rect.GetBottom(), rect.GetWidth(), rect.GetHeight(), 0);
+               glCopyTexImage2D(GL_TEXTURE_2D,0,GL_DEPTH_COMPONENT, 
rect.GetLeft(), rect.GetBottom(), rect_width, rect_height, 0);
        }
        
        if (need_luminance) {
                glActiveTextureARB(GL_TEXTURE2);
                glBindTexture(GL_TEXTURE_2D, texname[2]);
-               glCopyTexImage2D(GL_TEXTURE_2D,0,GL_LUMINANCE16, 
rect.GetLeft(), rect.GetBottom(), rect.GetWidth(), rect.GetHeight(), 0);
+               glCopyTexImage2D(GL_TEXTURE_2D,0,GL_LUMINANCE16, 
rect.GetLeft(), rect.GetBottom(), rect_width, rect_height, 0);
        }
 
        // reverting to texunit 0, without this we get bug [#28462]
        glActiveTextureARB(GL_TEXTURE0);
 
-       glViewport(rect.GetLeft(), rect.GetBottom(), rect.GetWidth()+1, 
rect.GetHeight()+1);
+       glViewport(rect.GetLeft(), rect.GetBottom(), rect_width, 
rect.GetHeight()+1);
 
        glDisable(GL_DEPTH_TEST);
        // in case the previous material was wire
@@ -454,7 +455,7 @@
 
                        glActiveTextureARB(GL_TEXTURE0);
                        glBindTexture(GL_TEXTURE_2D, texname[0]);
-                       glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 
rect.GetLeft(), rect.GetBottom(), rect.GetWidth(), rect.GetHeight(), 0); // 
Don't use texturewidth and textureheight in case we don't have NPOT support
+                       glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 
rect.GetLeft(), rect.GetBottom(), rect_width, rect_height, 0); // Don't use 
texturewidth and textureheight in case we don't have NPOT support
                        glClear(GL_COLOR_BUFFER_BIT);
 
                        glBegin(GL_QUADS);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to