writeContentsToFile

Gunnar

16-02-2006 10:00:50

Hi folks,

i want to write my frames to single .png Files. I got the hint to use the "writeContentsToFile" method from "RenderTarget". Can you please help with the implementation ? For example in the "SkeletalAnimationDemo.py" ( ogre_demos folder ). Excuse me, but i'm not that firm in object-oriented programming languages, but working hard on it :wink:

( of course in Python :wink: )

ciao and thanks,
Gunnar

dermont

17-02-2006 02:45:27

To capture a screenshot from the SkeletalAnimationDemo press 'PrintScreen' on your keyboard.

The code is in SampleFrameWork.py's FrameListener class:

def frameStarted(self, frameEvent):
self.inputDevice.capture()
.
if not self._processUnbufferedKeyInput(frameEvent):
return False
.

def _processUnbufferedKeyInput(self, frameEvent):
.
if self._isToggleKeyDown(ogre.KC_SYSRQ, 0.5):
path = 'screenshot_%d.png' % self.numScreenShots
self.numScreenShots += 1
self.renderWindow.writeContentsToFile(path)
self.renderWindow.debugText = 'screenshot taken: ' + path


and called from SkeletalAnimationFrameListener:

def frameStarted(self, frameEvent):
.
--> return sf.FrameListener.frameStarted(self, frameEvent)

Game_Ender

17-02-2006 05:59:29

I don't believe "WriteContentsToFile" if fully implemented in the Ogre 1.0.7 API you should check in the Change notes for the Dagon release of Ogre, because I am not sure whether it was RenderTargets or RenderTextures that got full support of "WriteContentsToFile".

Gunnar

17-02-2006 07:28:20

Thanks dermont !

:)

P.S.
k game_ender i'll have a look on it. But for now i'm working with 1.0.6 for testing reasons.

griminventions

17-02-2006 12:48:02

I just tried the Skeletal animation demo and it worked fine with PyOgre 1.0.6. Thanks a lot, dermont!! (To the rescue once again.) :)