BGE bug #29133: Render to Texture not working. Fixed by using same viewport to render...
authorBenoit Bolsee <benoit.bolsee@online.be>
Sat, 4 Feb 2012 17:20:38 +0000 (17:20 +0000)
committerBenoit Bolsee <benoit.bolsee@online.be>
Sat, 4 Feb 2012 17:20:38 +0000 (17:20 +0000)
source/gameengine/VideoTexture/ImageViewport.cpp

index 036dd893dcb29e733a32c83b7c4ab922a1312c92..a9354564d0e4e2f035b7697157ea69f56c3272e2 100644 (file)
@@ -31,6 +31,7 @@ http://www.gnu.org/copyleft/lesser.txt.
 
 #include "GL/glew.h"
 
+#include "KX_PythonInit.h"
 #include "Texture.h"
 #include "ImageBase.h"
 #include "FilterSource.h"
@@ -41,7 +42,13 @@ http://www.gnu.org/copyleft/lesser.txt.
 ImageViewport::ImageViewport (void) : m_alpha(false), m_texInit(false)
 {
        // get viewport rectangle
-       glGetIntegerv(GL_VIEWPORT, m_viewport);
+       RAS_Rect rect = KX_GetActiveEngine()->GetCanvas()->GetWindowArea();
+       m_viewport[0] = rect.GetLeft();
+       m_viewport[1] = rect.GetBottom();
+       m_viewport[2] = rect.GetWidth();
+       m_viewport[3] = rect.GetHeight();
+       
+       //glGetIntegerv(GL_VIEWPORT, m_viewport);
        // create buffer for viewport image
        m_viewportImage = new BYTE [4 * getViewportSize()[0] * getViewportSize()[1]];
        // set attributes