dermont
24-04-2007 08:56:49
Does anyone have an example of using RenderQueueListener or CompositorChain::RQListener in python-ogre?.
The following C++ code hides the overlay as expected:
The following python does not hide the overlay:
The following C++ code hides the overlay as expected:
class MyRenderQueueListener : public Ogre::RenderQueueListener
{
void renderQueueStarted ( uint8 queueGroupId, const String & invocation, bool & skipThisInvocation)
{
if (queueGroupId== RENDER_QUEUE_OVERLAY){
skipThisInvocation = true;
}
}
void renderQueueEnded(uint8 queueGroupId,const String & invocation, bool & repeatThisInvocation)
{
if (queueGroupId== RENDER_QUEUE_OVERLAY){
repeatThisInvocation = true;
}
}
};
mSceneMgr->addRenderQueueListener(new MyRenderQueueListener());
The following python does not hide the overlay:
import ogre.renderer.OGRE as ogre
import SampleFramework as sf
class MyRenderQueueListener(ogre.RenderQueueListener):
def renderQueueStarted (self, id , invocation, skipThisInvocation):
if (id == ogre.RENDER_QUEUE_OVERLAY):
print "Queue Start Skip %i %i " % (id,ogre.RENDER_QUEUE_OVERLAY)
skipThisInvocation = True
return False
def renderQueueEnded (self, id , invocation,repeatThisInvocation):
if (id == ogre.RENDER_QUEUE_OVERLAY):
print "Queue End Repeat %i %i" % (id, ogre.RENDER_QUEUE_OVERLAY)
repeatThisInvocation = True
class EnvMapApplication(sf.Application):
def _createScene( self ):
sceneManager = self.sceneManager
camera = self.camera
sceneManager.ambientLight = ogre.ColourValue (0.5, 0.5, 0.5)
light = sceneManager.createLight('MainLight')
light.setPosition (20, 80, 50)
entity = sceneManager.createEntity('head', 'ogrehead.mesh')
entity.setMaterialName("Examples/EnvMappedRustySteel")
self.myRenderQueueListener = MyRenderQueueListener()
self.renderQueueListener = sceneManager.addRenderQueueListener( self.myRenderQueueListener)
sceneManager.getRootSceneNode().createChildSceneNode().attachObject(entity)
if __name__ == '__main__':
try:
application = EnvMapApplication()
application.go()
except ogre.OgreException, e:
print e