Re: [PyOpenGL-Users] VBOs and gl*Pointer offset parameter
Brought to you by:
mcfletch
|
From: Mike C. F. <mcf...@vr...> - 2009-07-17 18:34:21
|
renaud blanch wrote:
> On Thu, Jul 16, 2009 at 8:32 PM, Mike C. Fletcher<mcf...@vr...> wrote:
>
...
>> ctypes.c_void_p( 12 )
>>
>> should work as an array offset of 12 bytes,
...
> no, it does not work (at least for me).
> that's what i was also doing.
>
Argh. ctypes c_void_p is a parameter type, not a pointer type (I knew
this, but I mis-coded for it). I've checked a 2-line patch into the
OpenGL.arrays.ctypesparameters file, it should show up in the next
release (which should happen reasonably soon, if I ever get enough time
to test). In the meantime, the following patch should work, or you
could use bzr head of PyOpenGL.
HTH,
Mike
=== modified file 'OpenGL/arrays/ctypesparameters.py'
--- OpenGL/arrays/ctypesparameters.py 2009-04-09 19:06:55 +0000
+++ OpenGL/arrays/ctypesparameters.py 2009-07-17 18:21:38 +0000
@@ -30,7 +30,7 @@
return ctypes.byref( value )
from_param = voidDataPointer = classmethod( from_param )
def dataPointer( cls, value ):
- if isinstance( value, ParamaterType ):
+ if isinstance( value, DIRECT_RETURN_TYPES ):
return value
else:
return ctypes.addressof( value )
@@ -95,6 +95,8 @@
yield length
def asArray( self, value, typeCode=None ):
"""Convert given value to an array value of given
typeCode"""
+ if isinstance( value, DIRECT_RETURN_TYPES ):
+ return value
if isinstance( value, ParamaterType ):
value = value._obj
return ctypes.byref( value )
--
________________________________________________
Mike C. Fletcher
Designer, VR Plumber, Coder
http://www.vrplumber.com
http://blog.vrplumber.com
|