Ok, my brother asked me to fix this bug a long time ago and I just now
got around to it.
It's pretty simple. In lib_glx.py glXGetProcAddressARB.restype is set
to c_void_p, which is what is expected in link_GL(). However, it is
changed to POINTER(CFUNCTYPE(None)) in glx.py, causing link_GL to
eventually fail. A simple fix is to just standardize it:
===================================================================
--- pyglet/gl/lib_glx.py (revision 914)
+++ pyglet/gl/lib_glx.py (working copy)
@@ -59,15 +59,15 @@
glu_lib = cdll.LoadLibrary(glu_path)
# Look for glXGetProcAddressARB extension, use it as fallback (for
-# ATI fglrx driver).
+# ATI fglrx and DRI drivers).
try:
glXGetProcAddressARB = getattr(gl_lib, 'glXGetProcAddressARB')
- glXGetProcAddressARB.restype = c_void_p
+ glXGetProcAddressARB.restype = POINTER(CFUNCTYPE(None))
glXGetProcAddressARB.argtypes = [POINTER(c_ubyte)]
_have_getprocaddress = True
except AttributeError:
_have_get_procaddress = False
@@ -82,7 +82,7 @@
addr = glXGetProcAddressARB(bname)
if addr:
ftype = CFUNCTYPE(*((restype,) + tuple(argtypes)))
- func = ftype(addr)
+ func = cast(addr, ftype)
decorate_function(func, name)
return func
I take it you guys use Intel and NVidia?
Hope this helps!
MWM
On May 2, 7:48 pm, Alex Holkner <[EMAIL PROTECTED]> wrote:
> On 03/05/2007, at 3:57 AM, joey101 wrote:
>
>
>
> > Hmm, then I have no idea what could be wrong. My brother has the same
> > problem though on his comp.
>
> Could you find out what's being returned from ctypes, for example by
> inserting this line
>
> print name, addr, type(addr)
>
> before line 52?
>
> Cheers
> Alex.
>
>
>
> > On Apr 30, 6:28 pm, Alex Holkner <[EMAIL PROTECTED]> wrote:
> >> On 01/05/2007, at 5:46 AM, joey101 wrote:
>
> >>> Sorry took so long to reply... I don't get enough internet time. :P
>
> >>> On line 50 in pyglet/gl/lib_glx.py I made it make sure the addr is
> >>> callable before running it though ftype()
>
> >>> if addr *and callable(addr)*:
>
> >>> and that fixes it for me. Or at least one of the problems :P
>
> >> Not really a useful fix... addr is only supposed to be an int (I'd
> >> settle for a number of some sort).
>
> >> Alex.
>
> >>> On Apr 12, 5:31 pm, Alex Holkner <[EMAIL PROTECTED]> wrote:
> >>>>> OpenGL vendor string: Tungsten Graphics, Inc.
> >>>>> OpenGL renderer string: Mesa DRI Radeon 20061018 AGP 1x x86/MMX/
> >>>>> SSE2
> >>>>> TCL
> >>>>> OpenGL version string: 1.3 Mesa 6.5.2
>
> >>>> This is an interesting driver that we've not seen before...
>
> >>>>> python 2.4
> >>>>> ctypes 1.0.1
>
> >>>> But this combination has been well-tested. But this traceback
>
> >>>> File "/home/joey/projects/pyglet/window/xlib/__init__.py", line
> >>>> 37,
> >>>> in ?
> >>>> from pyglet.gl.glxext_abi import *
> >>>> File "/home/joey/projects/pyglet/gl/glxext_abi.py", line 232,
> >>>> in ?
> >>>> glXSwapIntervalSGI = _link_function('glXSwapIntervalSGI',
> >>>> c_int,
> >>>> [c_int], 'SGI_swap_control')
> >>>> File "/home/joey/projects/pyglet/gl/lib_glx.py", line 52, in
> >>>> link_GL
> >>>> func = ftype(addr)
> >>>> TypeError: argument must be callable or integer function address
>
> >>>> suggests a problem with ctypes, not the driver. Could you find out
> >>>> what's being returned into 'addr' here, for example by inserting
> >>>> this
> >>>> line
>
> >>>> print name, addr, type(addr)
>
> >>>> before line 52 in pyglet/gl/lib_glx.py?
>
> >>>>> [EMAIL PROTECTED] tests $ python test.py
> >>>>> Traceback (most recent call last):
> >>>>> File "test.py", line 201, in ?
> >>>>> import tests.regression
> >>>>> ImportError: No module named tests.regression
>
> >>>> This looks like your working checkout is broken, perhaps try
> >>>> checking
> >>>> out trunk cleanly again? (svn is not without its faults).
>
> >>>> Alex.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---