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

Re: [pygame] GLSL in Pygame on a Mac



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.