Re: glGetUniformIndices

Urs Schulz <[email protected]>
Newsgroups gmane.comp.python.opengl.user
Message-ID <[email protected]>
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


------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
PyOpenGL Homepage
http://pyopengl.sourceforge.net
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.