ScissorEffect flickering

Okay, an update:

Removing the underlying scissor-effects doesn’t seem to solve the problem.

In fact, further testing indicates that the ScissorEffects don’t even have to overlap to cause this effect! Nor do the nodes bearing ScissorEffects have to be parent and child.

It looks like this happens when I have:

  • Two or more ScissorEffects active (on different nodes)
  • The frame-size of at least one of them is changed
  • And the scissor-effect associated with the changed node is re-made to account for the new bounds.

And updated test-program follows. Note that the two nodes are no longer parent and child, and that they no longer visibly overlap. If you change self.frame2 to be a DirectFrame instead of the custom-class defined in the program (via the commented-out line), you should see the flickering disappear.

It is very possible that I’ve made some mistake with the points that I use to define my ScissorEffects.

from direct.gui.DirectGui import DirectFrame
from panda3d.core import ScissorEffect, Vec3
from direct.task import Task

from direct.showbase import ShowBase as showBase

class Mew(DirectFrame):
    def __init__(self, parent = None, **kwargs):
        optiondefs = (
             ('frameSize',      (-0.5, 0.5, -0.5, 0.5),         self.setFrameSize),
            )

        self.defineoptions(kwargs, optiondefs)

        DirectFrame.__init__(self, parent)

        self.initialiseoptions(Mew)


    def setFrameSize(self, fClearFrame = 0):
        frameSize = self["frameSize"]
        self.clearEffect(ScissorEffect)
        self.setScissor(Vec3(frameSize[0], 0, frameSize[2]),
                            Vec3(frameSize[1], 0, frameSize[2]),
                            Vec3(frameSize[0], 0, frameSize[3]),
                            Vec3(frameSize[1], 0, frameSize[3]),
                                 )

        DirectFrame.setFrameSize(self, fClearFrame)

class Game(showBase.ShowBase):

    def __init__(self):
        showBase.ShowBase.__init__(self)

        self.accept("escape", self.userExit)

        self.frame = Mew(frameColor = (0, 0.2, 1, 1), frameSize = (-0.1, -0.09, -0.1, 0.1))

        self.frame2 = Mew(frameColor = (0, 1, 0, 1), frameSize = (0.1, 0.2, -0.1, 0.1))
        #self.frame2 = DirectFrame(frameColor = (0, 1, 0, 1), frameSize = (0.1, 0.2, -0.1, 0.1))

        self.updateTask = taskMgr.add(self.update, "update")

    def update(self, task):

        dt = globalClock.getDt()

        frameSize = self.frame["frameSize"]
        frameSize = (frameSize[0] - 0.1*dt, frameSize[1], frameSize[2] - 0.1*dt, frameSize[3] + 0.1*dt)

        self.frame["frameSize"] = frameSize

        return Task.cont

app = Game()
app.run()

Any thoughts? :/