problem with manualObject

danx0r

20-11-2008 05:01:55

hi folks --

this code runs in 1.4 but crashes in 1.6 (runs from demos/ogre):

------------------------------------------------------
import sys
sys.path.insert(0,'..')
import ogre.renderer.OGRE as ogre
import SampleFramework as sf

class tri(ogre.ManualObject):
#simplest possible manual object, for testing purposes
#takes 3 tuples A, B, C
def __init__(me, name, A, B, C):
me.A = A
me.B = B
me.C = C
ogre.ManualObject.__init__(me, name)
A, B, C = me.A, me.B, me.C
me.clear()
me.begin("default", ogre.RenderOperation.OT_TRIANGLE_STRIP)
me.position(A[0], A[1], A[2])
me.normal(0, 0, 1)
me.position(B[0], B[1], B[2])
me.position(C[0], C[1], C[2])
me.position(A[0], A[1], A[2])
me.end()

class TutorialApplication(sf.Application):

def _createScene(self):
sceneManager = self.sceneManager
sceneManager.ambientLight = ogre.ColourValue (0.3,0.3,0.3)
self.ent = tri("triangle", (0,0,0), (0,100,0), (100,0,0) )
node1 = sceneManager.getRootSceneNode().createChildSceneNode ("node1")
node1.attachObject (self.ent)

ta = TutorialApplication()
ta.go()
------------------------------------------------------

here's what I get when I run it in 1.6:

(0) : fatal error C9999: *** exception during compilation ***
Cg compiler terminated due to fatal error]0;dbm@zareason: ~/bench/python-ogre/demos/ogredbm@zareason:~/bench/python-ogre/demos/ogre$ exit

danx0r

20-11-2008 06:01:20

workaround:

if I avoid calling manobj.clear(), and always call manobj.estimateVertexCount() and estimateIndexCount() before each begin() section, it doesn't crash.

this is a pain though as sometimes I may want to reuse an object but change the number of sections.

-dan

andy

20-11-2008 09:46:14

Apart from needing cleanup on the exit your example works fine for me...

Added the following code for cleanup
def __del__ ( self ):
del self.ent



Regards
Andy

danx0r

20-11-2008 19:45:15

Are you running on Windows? I'm seeing the problem on Ubuntu 8.04 - dan

Game_Ender

08-02-2009 00:18:18

I am still getting this problem on Ubuntu 8.04 Python-Ogre SVN r830. I haven't found any other fix for it then one you gave above.

andy

08-02-2009 02:32:26

Any chance of testing it with C++ just to make sure it's a PO bug and not an Ogre one?

Thanks
Andy