[solved] display regions (splitscreen) and CommonFilters

Hi all,

I have a problem with display regions and CommonFilters.
I create two display regions, splitting the screen in two halfs. Then I add a third region and change the dimensions of the second one to get free space for the new one. No problem so far, but if I add a Shader with CommonFilters and change the dimensions of the region after that, it doesn’t seem to have an effect. The new region overlaps the old one. I uploaded an image which shows the problem.
On the left window everything works fine without shaders, on the right window I added a blur shader and somehow the regions are not updated:

Below is the code, which produced the above output. I think I have to tell the CommonFilter object that the regions have changed, but I’m not sure how to do that. I tried it with filters.cleanup, filters.reconfigure and filters.update, but none of them worked.

# -*- coding: utf-8 -*-

from direct.showbase.ShowBase import ShowBase
from panda3d.core import *
from direct.filter.CommonFilters import CommonFilters

class App(ShowBase):
    def __init__(self):
        base.camNode.setActive(False) #disable default cam
        # add a model to the scene
        panda = loader.loadModel("models/panda-model")
        # create the first region
        region1 = base.win.makeDisplayRegion(0, 0.5, 0, 1)
        cam1 = NodePath(Camera('cam1'))
        # create a second region
        region2 = base.win.makeDisplayRegion(0.5, 1, 0, 1)
        cam2 = NodePath(Camera('cam2'))
        # add the filters
        filters1 = CommonFilters(base.win, cam1) # for the 1st cam
        filters2 = CommonFilters(base.win, cam2) # for the 2nd cam
        # now change the region of the 2nd cam <- and here is the problem
        cam2.node().getDisplayRegion(0).setDimensions(0.5, 1, 0.5, 1)
        # mabe here I should update the CommonFilter objects
        # add a 3rd cam / region
        region3 = base.win.makeDisplayRegion(0.5, 1, 0, 0.5)
        cam3 = NodePath(Camera('cam3'))
# -----------------------------------------------------------------------------

app = App()

Any ideas?
thanks in advance,

PS: here the link to the CommonFilters Documentation: http://www.panda3d.org/reference/python/class!filter.CommonFilters.CommonFilters

I solved the problem now, thanks to the IRC-Users. :smiley:
Somehow it works if the shader is deactivated before changing the region. After changing it, the shader can be reactivated:

cam2.node().getDisplayRegion(0).setDimensions(0.5, 1, 0.5, 1)