Am Montag, den 16.01.2012, 12:41 -0500 schrieb Mike C. Fletcher:
> On 12-01-16 12:32 PM, Hans Wurst wrote:
> > Hi guys,
> >
> > I've written the following wrapper-code for glGetUniformIndices:
> >
> > @lazy( glGetUniformIndices )
> > def glGetUniformIndices(baseOperation, program, uniformNames):
> > num = len(uniformNames)
> > maxLen = max([len(x) for x in uniformNames])+1
> > names = ((ctypes.c_char * maxLen) * num)()
> I believe you want ctypes.c_char_p * num here, with this formulation
> you'd then need to create a new array of pointers each of which was
> pointing at the beginning of the row for that value. Don't have a
> test-case handy to test that assumption, though.
> > for i,name in enumerate(uniformNames):
> > names[i].value = name
> > c_names = ctypes.cast(ctypes.pointer(ctypes.pointer(names)),
> >
> > ctypes.POINTER(ctypes.POINTER(OpenGL.constants.GLchar)))
> > obuff = (ctypes.c_uint32 * num)()
> > print ctypes.byref(obuff)
> > print c_names
> > print "Before", baseOperation.__name__
> > baseOperation(program, num, c_names, ctypes.byref(obuff))
> > print "After", baseOperation.__name__
> > return [o.value for o in obuff]
> HTH,
> Mike
>
Sorry for double-mailing my answer, but I think something was wrong with
my mail client. I don't understand your suggestion, do you have some
example code or can go into more detail please? Code would be great.
Thx
|