On Mon, Jan 24, 2011 at 4:37 AM, evil.phillip <[email protected]> wrote:
>
> Tristam:
>
> I came across that same post about the setValues:forParameter: patch
> -- I took it as a bad sign that someone had already solved this in
> 2006, but the fix doesn't seem to be in even the 2.4 development
> version of PyObjC.  I thought maybe that I could trick PyObjC into
> working with ctypes like this:
>
>        cglContext = self._nscontext.CGLContextObj()  # <--- PyObjC
> object
>        dir(cglContext)  # we have to call this first in order to find
> pointerAsInteger??
>        ctypes_context = c_void_p(cglContext.pointerAsInteger)
>        param = c_int(1)
>        quartz = cdll.LoadLibrary(util.find_library('Quartz'))
>        quartz.CGLSetParameter(ctypes_context, kCGLCPSwapInterval,
> byref(param))

Ah, clever - I forgot that Quartz already exposed a C binding to that
functionality. Is there any particular reason you are trying to do
that via ctypes, rather than through PyObjC's own Quartz package?

I was actually talking about a much lower-level solution. You can send
Objective-C messages from pure C (and thus ctypes) via the
objc_msgSend() function (which is the underlying implementation of
Objective-C messaging):

http://developer.apple.com/library/mac/#documentation/cocoa/reference/objcruntimeref/Reference/reference.html#//apple_ref/doc/c_ref/objc_msgSend

-- 
Tristam MacDonald
System Administrator, Suffolk University Math & CS Department
tel: (617) 973-5398
http://swiftcoder.wordpress.com/

-- 
You received this message because you are subscribed to the Google Groups 
"pyglet-users" 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/pyglet-users?hl=en.

Reply via email to