Filter on split screen

Hi, I’m trying to apply a 2D filter on a game which is running in 2 different viewports, using this script to split the screen:

import Rasterizer
import bge
def main():
 controller = bge.logic.getCurrentController()
 object = controller.owner
 scene = bge.logic.getCurrentScene()
 width = Rasterizer.getWindowWidth()
 height = Rasterizer.getWindowHeight()
 cam1 = scene.objects["Camera_1"]
 cam2 = scene.objects["Camera_2"]
 scene.active_camera = cam1
 left1 = 0
 right1 = width
 bottom1 = int(height / 2)
 top1 = height
 left2 = 0
 right2 = width
 bottom2 = 0
 top2 = int(height / 2)
 cam1.setViewport(left1, bottom1, right1, top1)
 cam1.useViewport = True
 cam2.setViewport(left2, bottom2, right2, top2)
 cam2.useViewport = True

I’m using this greyscale filter written in GLSL (I attached a ‘Custom Filter’ actuator to an ‘And’ controller to an ‘Always’ sensor in an empty mesh’s logic bricks).

uniform sampler2D bgl_RenderedTexture;
void main(void)
 vec4 color = texture2D(bgl_RenderedTexture, gl_TexCoord[0].st);
 float fAvg = (color.r + color.g + color.b) / 3.0;
 gl_FragColor = vec4(fAvg, fAvg, fAvg, 1);

My problem is that when I run the game the filter is applied and works perfectly only on one of the camera viewports (Camera_2), but not on the other. Is there any way I can apply the filter on BOTH viewports?

PS: I’ve also tried running the filter from Camera_1’s logic bricks but it applied the same filter on the same viewport twice. I also tried different filters. I’m using Blender 2.59 if it helps…

Please I really need help on this one.
Cheers, Dean

Sorry about posting in the wrong section, I didn’t mean to.

Ok, I guess I’ll have to work without filters then haha, thanks for you reply :slight_smile: