chpod
06-08-2008 19:25:19
Hi all,
I am trying to read all named constants with their respective values for a fragment program.
Till now I managed to read the named constants (the keys). However, I am in trouble while trying to read the values.
Here is the code I use:
And here is the error message:
There must be some pointer trouble between python and C++. I am a complete newbie regarding this kind of things, and I really fee lost...
Thx for you help,
chpod
I am trying to read all named constants with their respective values for a fragment program.
Till now I managed to read the named constants (the keys). However, I am in trouble while trying to read the values.
Here is the code I use:
def getFragmentProgramKeys(self,fragmentProgramName):
mat = ogre.MaterialManager.getSingleton().getByName(fragmentProgramName)
# In case the material is not found
if (mat == None):
print "Material not found: ",fragmentProgramName
return([])
validkeys = []
if (mat.getTechnique(0).getPass(0).hasFragmentProgram()):
params = mat.getTechnique(0).getPass(0).getFragmentProgramParameters()
if (params.hasNamedParameters()):
it = params.getConstantDefinitionIterator()
while (True):
# Get the key
key = it.peekNextKey()
print "KEY: ",key
# And the corresponding value
from ctypes import c_ulong
p = c_ulong()
value = it.peekNextValue()
index = value.physicalIndex
size = value.elementSize
result = 0
params._readRawConstants (index, size, p)
print "VALUE: ",p
if (key.isalpha() and params._findNamedConstantDefinition(key)):
validkeys.append(key)
it.moveNext()
if (not it.hasMoreElements()):
break
return(validkeys)
And here is the error message:
GpuProgramParameters._readRawConstants(GpuProgramParameters, int, int, c_ulong)
did not match C++ signature:
_readRawConstants(class Ogre::GpuProgramParameters {lvalue} inst, unsigned int physicalIndex, unsigned int count, unsigned int dest)
_readRawConstants(class Ogre::GpuProgramParameters {lvalue} inst, unsigned int physicalIndex, unsigned int count, unsigned int dest)
There must be some pointer trouble between python and C++. I am a complete newbie regarding this kind of things, and I really fee lost...
Thx for you help,
chpod