On Mon, May 3, 2010 at 3:02 AM, Richard Jones <[email protected]>wrote:

> On Fri, Apr 30, 2010 at 12:56 AM,  <[email protected]> wrote:
> > @@ -77,5 +75,5 @@
> >
> >     def __del__(self):
> >         '''Delete the framebuffer from the GPU memory'''
> > -        id = c_ulong(self._id)
> > -        glDeleteFramebuffersEXT(1, byref(id))
> > +        id = GLuint(self._id)
> > +        glDeleteFramebuffersEXT(1, id)
>
> There appears to be a byref() lost there...
>
>
>      Richard
>
>


All-right, will commit the change tomorrow. If it is important, pyglet has
identical use in a call to glDeleteTextures  (pyglet\gl\__init__.py, line
395 , pyglet 1.1.4 release)

Looking with C goggles the call using byref looks better, it pass a pointer
when a pointer is required, while the second form (without byref) will
instantly trigger a  NOOOOO!!!!
I assume it works because ctypes does some promotion, else it should raise
an exception.
>From the 2.6.5 docs:
"""
ctypes exports the byref() function which is used to pass parameters by
reference. The same effect can be achieved with the pointer function,
although pointer does a lot more work since it constructs a real pointer
object, so it is faster to use byref() if you don’t need the pointer object
in Python itself
"""
but also
"""
Usually, ctypes does strict type checking. This means, if you have
POINTER(c_int) in the argtypes list of a function or as the type of a member
field in a structure definition, only instances of exactly the same type are
accepted. There are some exceptions to this rule, where ctypes accepts other
objects. For example, you can pass compatible array instances instead of
pointer types. So, for POINTER(c_int), ctypes accepts an array of c_int
"""
If ctypes strict type checking is indeed working, then an implicit, unstated
conversion should take place in the call  glDeleteFramebuffersEXT(1, id) ?

--
claudio

-- 
You received this message because you are subscribed to the Google Groups 
"cocos2d discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cocos-discuss?hl=en.

Reply via email to