2DFilter bugfixes:
authorDalai Felinto <dfelinto@gmail.com>
Sun, 12 Apr 2009 19:46:50 +0000 (19:46 +0000)
committerDalai Felinto <dfelinto@gmail.com>
Sun, 12 Apr 2009 19:46:50 +0000 (19:46 +0000)
[#18154] 2dFilter and motion blur should run only once to all the scenes
[#18504] The GL_PROJECTION matrix is being reset by the 2dfilter.

source/gameengine/Ketsji/KX_KetsjiEngine.cpp
source/gameengine/Rasterizer/RAS_2DFilterManager.cpp

index e64ffa95161018ddcf0eb65cefae422f8cb9413a..aeb80806f6cb56f91005a7fa9413ccc951471024 100644 (file)
@@ -898,6 +898,9 @@ void KX_KetsjiEngine::Render()
                }
        } // if(m_rasterizer->Stereo())
 
+       // run the 2dfilters and motion blur once for all the scenes
+       PostRenderFrame();
+
        EndFrame();
 }
 
@@ -1264,16 +1267,12 @@ void KX_KetsjiEngine::RenderFrame(KX_Scene* scene, KX_Camera* cam)
                scene->GetPhysicsEnvironment()->debugDrawWorld();
        
        m_rasterizer->FlushDebugLines();
-
-       PostRenderFrame();
 }
 
 void KX_KetsjiEngine::PostRenderFrame()
 {
-       m_rendertools->PushMatrix();
        m_rendertools->Render2DFilters(m_canvas);
        m_rendertools->MotionBlur(m_rasterizer);
-       m_rendertools->PopMatrix();
 }
 
 void KX_KetsjiEngine::StopEngine()
index 282c730628591f29c43e1b355f45997db498890f..176da51b183d294e2735ec1d1e63f807b613a8a1 100644 (file)
@@ -435,11 +435,12 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas)
        glViewport(0,0, texturewidth, textureheight);
 
        glDisable(GL_DEPTH_TEST);
+       glPushMatrix();         //GL_MODELVIEW
+       glLoadIdentity();       // GL_MODELVIEW
        glMatrixMode(GL_TEXTURE);
        glLoadIdentity();
        glMatrixMode(GL_PROJECTION);
-       glLoadIdentity();
-       glMatrixMode(GL_MODELVIEW);
+       glPushMatrix();
        glLoadIdentity();
 
        for(passindex =0; passindex<MAX_RENDER_PASS; passindex++)
@@ -466,6 +467,9 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas)
        glEnable(GL_DEPTH_TEST);
        glViewport(viewport[0],viewport[1],viewport[2],viewport[3]);
        EndShaderProgram();     
+       glPopMatrix();
+       glMatrixMode(GL_MODELVIEW);
+       glPopMatrix();
 }
 
 void RAS_2DFilterManager::EnableFilter(vector<STR_String>& propNames, void* gameObj, RAS_2DFILTER_MODE mode, int pass, STR_String& text)