[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] GLSL in Pygame on a Mac



Thanks, that seems to be the solution.

Interestingly, perhaps this is a Python feature that I am unaware of but this seems strange to me:

>>> import ctypes
>>> ctypes.util.find_library
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
AttributeError: 'module' object has no attribute 'util'
>>> from ctypes.util import find_library
>>>

Is there something unique about the util module in ctypes?

Thanks again!

Cheers,
  Brandon

On Dec 16, 2006, at 10:54 PM, Alex Holkner wrote:

Brandon N wrote:

Hello,
I recently came across the GLSL example at: http:// www.pygame.org/ wiki/GLSLExample


This would appear to meet my needs for using GLSL from within pygame, but I cannot seem to get it working. First, as I am not really familiar with the Python wrapper of OpenGL, is that example Mac friendly? If so, is there a reason why it would fail on my machine when I have OpenGL installed?

My exception (which just shows that neither loading method is working):
OSError: dlopen(libGL.so, 6): image not found


at file root
  in shader_test.py at line 14
function LoadLibrary
  in __init__.py at line 395
function __init__
  in __init__.py at line 312

I am not really certain where to go with this, so thanks for any assistance!

The example is Linux-centric, trying to load libGL.so. On Mac, the functions are in the OpenGL.framework. Replace the line `gl = cdll.LoadLibrary('libGL.so')` with


import ctypes.util
path = ctypes.util.find_library('OpenGL') # finds the absolute path to the framework
gl = cdll.LoadLibrary(path)


Cheers
Alex.