baseVertexPointerToElement() problem


01-11-2006 04:50:54

vertexData = mesh.sharedVertexData
vD = vertexData.vertexDeclaration
vE = vD.findElementBySemantic(ogre.VES_POSITION)
print vE.getSource()
vBB = vertexData.vertexBufferBinding
buffer = vBB.getBuffer(vE.getSource())
lock = buffer.lock(vD,buffer.HBL_READ_ONLY)
elem = vE.baseVertexPointerToElement(lock,pReal)

system said

No matching function for overloaded 'VertexElement_baseVertexPointerToElement'

Is it meaning that the function is not supported by pyogre?

i saw

class VertexElement(object):

_def baseVertexPointerToElement(*args):
__baseVertexPointerToElement(self, void pBase, void pElem)
__baseVertexPointerToElement(self, void pBase, float pElem)
__baseVertexPointerToElement(self, void pBase, RGBA pElem)
__baseVertexPointerToElement(self, void pBase, unsigned char pElem)
__baseVertexPointerToElement(self, void pBase, unsigned short pElem)
__return _ogre.VertexElement_baseVertexPointerToElement(*args)

Thank you very much!


21-11-2006 15:09:39

i have the exact same problem. somebody help pls. thanks!


21-11-2006 15:25:20

haven't tested this though, but this might be the solution!

use the snippet for loading vertices and indices data from xml here: ... rtoelement

use the ogre commandtools to convert .mesh to .xml


21-11-2006 16:58:44

You can obtain the vertices and indices from the submesh as indicated in the last post from the thread you reference.

You just need to test if the submesh uses shared vertices. If it does "vertices" returns the mesh sharedVertexData, otherwise "vertices" returns the submesh vertexData.

Something along the lines of (not tested):

mesh = entity.mesh
verts = []
indices = []
useShared = False
for i in range(mesh.numSubMeshes):
print "SubMesh",i, mesh.getSubMesh(i).useSharedVertices, len(mesh.getSubMesh(i).vertices),len(mesh.getSubMesh(i).indices)

if not useShared:
verts+= mesh.getSubMesh(i).vertices
useShared = mesh.getSubMesh(i).useSharedVertices

print "----------------"
print "Total Vertices %i Indices %i" % (len(verts), len(indices))
print "----------------"