Andrew Wilson wrote:
> Hey Jon,
> Would you mind sharing your GLSL shaders program? Also, I seemed to
> have cleared up my 3d texture problem by installing glewpy, don't know
> why this fixed it but it just started working...
Hmm, I wonder if they substituted some extension for the extended core
GL function? I've thought about doing things like that once in a while,
it just doesn't seem to be safe if there happens to be some subtle
difference between the two implementations. Still, would make the
coding easier for users...
Anyway, have fun,
Mike
--
________________________________________________
Mike C. Fletcher
Designer, VR Plumber, Coder
http://www.vrplumber.comhttp://blog.vrplumber.com

Dear list,
I'm struggling with offscreen rendering with PyOpengl. I found a number
of examples using pbuffers or the newer and seemingly better
PixelBufferObject - both of which are supported on my hardware.
My problem now is to translate these examples to pyOpengl (v3.0). Does
someone know if these extensions are supported at all in the python
bindings? Grepping the sources for something like "pbuffer" or
"GLX_SGIX_fbconfig" yields no matches...
What would help me maximally is an example of how to init, render and
readback sth from an offscreen buffer of any kind.
Thanks a lot,
Mathias
[also posted on c.g.api.opengl]

Andrew Wilson wrote:
> Hello,
> I found a newer glu version compiled for win32. Unfortunately winxp
> has a file protection scheme that won't allow me to overwrite
> glu32.dll with the newer version. Is there a way to force pyopengl to
> use different dll's?
There is, though it feels a bit hacky and has AFAIK never been tested.
Here's an example where I make the GLU DLL a completely unrelated
library (so there will be no GLU functionality at all):
>>> import ctypes
>>> glu = ctypes.CDLL( '/usr/lib/libFLAC.so' )
>>> platform.GLU = glu
>>> from OpenGL.GLU import *
>>> gluGetString
<OpenGL.platform.gluGetString object at 0x2aaaabc82f10>
>>> gluGetString( GLU_VERSION )
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File
"/var/pylive/src/OpenGL-dev/OpenGL-ctypes/OpenGL/platform/__init__.py",
line 186, in __call__
self.__name__, self.__name__,
OpenGL.error.NullFunctionError: Attempt to call an undefined function
gluGetString, check for bool(gluGetString) before calling
(You will need to use WinDLL, not CDLL for win32). You may want to use
OpenGL.platform.ctypesloader.loadLibrary( ctypes.windll,
path_to_your_library ) instead of the bald ctypes operations, as older
ctypes versions should be supported with that function.
Good luck,
Mike
>
> On 2/8/07, *Andrew Wilson* <andrewwilson@...
> <mailto:andrewwilson@...>> wrote:
>
> Hey Mike,
> You hit the nail on the head, my version of GLU is '1.2.2.0
> <http://1.2.2.0&gt; Microsoft Corporation'. This may be a silly
> question, is there any way to update glu to 1.3 on win32?
> Thanks
> Andrew
>
--
________________________________________________
Mike C. Fletcher
Designer, VR Plumber, Coder
http://www.vrplumber.comhttp://blog.vrplumber.com

Mike C. Fletcher schrieb:
> Martin Felder wrote:
>> Hi,
>>
>> in trying to get my python OpenGL application to run under cygwin, I
>> installed the
>> PyOpenGL package, version 3.0.0a5 for python 2.4, and ctypes 1.0.1.
>> For one thing, could it be the .egg is broken? I keep getting
>>
> The .egg uploaded to the CheeseShop for some reason appears as a
> corrupted.zip. The one on SourceForge appears to work (I just installed
> from that on Win32 yesterday).
> ...
>> zipimport.ZipImportError: not a Zip file: 'PyOpenGL-3.0.0a5-py2.4.egg'
> I'll try to get the next release out ASAP to fix that. It's about time
> for one anyway.
>> Well, anyway, the .zip file worked. Now
>> whenever I try to run an OpenGL application, the following happens:
> ...
>> line 29, in ?
>> mode=ctypes.RTLD_GLOBAL
>> File
>> "/usr/lib/python2.4/site-packages/PyOpenGL-3.0.0a5-py2.4.egg/OpenGL/platform/ctypesloader.py",
>>
>> line 37, in loadLibrary
>> return dllType( name, mode )
>> File "/usr/lib/python2.4/site-packages/ctypes/__init__.py", line 312,
>> in __init__
>> self._handle = _dlopen(self._name, mode)
>> OSError: No such file or directory
>>
>> When this happens, self._name is "GL" and mode is 4. It would seem as
>> though somehow the GL library is not registered(?) with python? I'm at a
>> loss here - can anybody give me a hint? Has there been any successful
>> attempt at running PyOpenGL under cygwin?
> AFAIK there has been no successful attempt. From what I understand one
> of the tools inside ctypes is using an operation that doesn't work under
> cygwin, so it winds up unable to find the .so files. I haven't yet gone
> to the trouble of installing cygwin w/X in order to track down the
> problem. Likely we'll need to rewrite the find_library code to be able
> to deal with cygwin (and hopefully get that into ctypes for the next
> release).
I haven't run ctypes under cygwin for a long time, so I'm not sure any longer
it works correctly. However, if someone provides working patches I will
consider to accept them.
Thomas

Andrew Wilson wrote:
> Hello,
> I'm trying to use gluBuild3DMipmaps, but I come upon the following
> error message,
>
> OpenGL.error.NullFunctinoError: Attempt to call an undefined function
> gluBuild3DMipmaps, check for bool(gluBuild3DMipmaps) before calling.
>
>
> So I print out bool(gluBuild3DMipmaps) and of course get False. how
> do I get gluBuild3DMipmaps working? I'm running
> pyopengl-3.0.0a5-py2.4.egg
"gluBuild3DMipmaps is only available if the GLU version is 1.3 or
greater", mostly likely the system on which you are running has a GLU
version less than 1.3.
>>> from OpenGL.GLU import *
>>> gluGetString( GLU_VERSION )
'1.3'
>>> gluBuild3DMipmaps
<CFunctionType object at 0x2aaaab8c8a78>
>>>
Or it could be that you're running on a platform that has some strange
semantics surrounding access to GLU features for versions > 1.0. Above
session is from a modern Linux desktop.
Good luck,
Mike
--
________________________________________________
Mike C. Fletcher
Designer, VR Plumber, Coder
http://www.vrplumber.comhttp://blog.vrplumber.com

Martin Felder wrote:
> Hi,
>
> in trying to get my python OpenGL application to run under cygwin, I
> installed the
> PyOpenGL package, version 3.0.0a5 for python 2.4, and ctypes 1.0.1.
> For one thing, could it be the .egg is broken? I keep getting
>
The .egg uploaded to the CheeseShop for some reason appears as a
corrupted.zip. The one on SourceForge appears to work (I just installed
from that on Win32 yesterday).
...
> zipimport.ZipImportError: not a Zip file: 'PyOpenGL-3.0.0a5-py2.4.egg'
I'll try to get the next release out ASAP to fix that. It's about time
for one anyway.
> Well, anyway, the .zip file worked. Now
> whenever I try to run an OpenGL application, the following happens:
...
> line 29, in ?
> mode=ctypes.RTLD_GLOBAL
> File
> "/usr/lib/python2.4/site-packages/PyOpenGL-3.0.0a5-py2.4.egg/OpenGL/platform/ctypesloader.py",
>
> line 37, in loadLibrary
> return dllType( name, mode )
> File "/usr/lib/python2.4/site-packages/ctypes/__init__.py", line 312,
> in __init__
> self._handle = _dlopen(self._name, mode)
> OSError: No such file or directory
>
> When this happens, self._name is "GL" and mode is 4. It would seem as
> though somehow the GL library is not registered(?) with python? I'm at a
> loss here - can anybody give me a hint? Has there been any successful
> attempt at running PyOpenGL under cygwin?
AFAIK there has been no successful attempt. From what I understand one
of the tools inside ctypes is using an operation that doesn't work under
cygwin, so it winds up unable to find the .so files. I haven't yet gone
to the trouble of installing cygwin w/X in order to track down the
problem. Likely we'll need to rewrite the find_library code to be able
to deal with cygwin (and hopefully get that into ctypes for the next
release).
Good luck,
Mike
--
________________________________________________
Mike C. Fletcher
Designer, VR Plumber, Coder
http://www.vrplumber.comhttp://blog.vrplumber.com

Hello,
I'm trying to use gluBuild3DMipmaps, but I come upon the following error
message,
OpenGL.error.NullFunctinoError: Attempt to call an undefined function
gluBuild3DMipmaps, check for bool(gluBuild3DMipmaps) before calling.
So I print out bool(gluBuild3DMipmaps) and of course get False. how do I
get gluBuild3DMipmaps working? I'm running pyopengl-3.0.0a5-py2.4.egg
Thanks
Andrew

Hi,
in trying to get my python OpenGL application to run under cygwin, I
installed the
PyOpenGL package, version 3.0.0a5 for python 2.4, and ctypes 1.0.1. For
one thing, could it be the .egg is broken? I keep getting
225> easy_install PyOpenGL-3.0.0a5-py2.4.egg
Processing PyOpenGL-3.0.0a5-py2.4.egg
Traceback (most recent call last):
File "/usr/bin/easy_install", line 7, in ?
sys.exit(
File
"/usr/lib/python2.4/site-packages/setuptools-0.6c5-py2.4.egg/setuptools/command/easy_install.py",
line 1670, in m
ain
with_ei_usage(lambda:
File
"/usr/lib/python2.4/site-packages/setuptools-0.6c5-py2.4.egg/setuptools/command/easy_install.py",
line 1659, in w
ith_ei_usage
return f()
File
"/usr/lib/python2.4/site-packages/setuptools-0.6c5-py2.4.egg/setuptools/command/easy_install.py",
line 1674, in <
lambda>
distclass=DistributionWithoutHelpCommands, **kw
File "/tmp/python.340/usr/lib/python2.4/distutils/core.py", line 149,
in setup
File "/tmp/python.340/usr/lib/python2.4/distutils/dist.py", line 946,
in run_commands
File "/tmp/python.340/usr/lib/python2.4/distutils/dist.py", line 966,
in run_command
File
"/usr/lib/python2.4/site-packages/setuptools-0.6c5-py2.4.egg/setuptools/command/easy_install.py",
line 211, in ru
n
self.easy_install(spec, not self.no_deps)
File
"/usr/lib/python2.4/site-packages/setuptools-0.6c5-py2.4.egg/setuptools/command/easy_install.py",
line 427, in ea
sy_install
return self.install_item(None, spec, tmpdir, deps, True)
File
"/usr/lib/python2.4/site-packages/setuptools-0.6c5-py2.4.egg/setuptools/command/easy_install.py",
line 471, in in
stall_item
dists = self.install_eggs(spec, download, tmpdir)
File
"/usr/lib/python2.4/site-packages/setuptools-0.6c5-py2.4.egg/setuptools/command/easy_install.py",
line 619, in in
stall_eggs
return [self.install_egg(dist_filename, tmpdir)]
File
"/usr/lib/python2.4/site-packages/setuptools-0.6c5-py2.4.egg/setuptools/command/easy_install.py",
line 670, in in
stall_egg
dist = self.egg_distribution(egg_path)
File
"/usr/lib/python2.4/site-packages/setuptools-0.6c5-py2.4.egg/setuptools/command/easy_install.py",
line 661, in eg
g_distribution
metadata = EggMetadata(zipimport.zipimporter(egg_path))
zipimport.ZipImportError: not a Zip file: 'PyOpenGL-3.0.0a5-py2.4.egg'
Well, anyway, the .zip file worked. Now
whenever I try to run an OpenGL application, the following happens:
Traceback (most recent call last):
File "GLvis.py", line 8, in ?
from OpenGL.GL import *
File
"/usr/lib/python2.4/site-packages/PyOpenGL-3.0.0a5-py2.4.egg/OpenGL/GL/__init__.py",
line 2, in ?
from OpenGL.raw.GL import *
File
"/usr/lib/python2.4/site-packages/PyOpenGL-3.0.0a5-py2.4.egg/OpenGL/raw/GL/__init__.py",
line 6, in ?
from OpenGL.raw.GL.constants import *
File
"/usr/lib/python2.4/site-packages/PyOpenGL-3.0.0a5-py2.4.egg/OpenGL/raw/GL/constants.py",
line 7, in ?
from OpenGL import platform, arrays
File
"/usr/lib/python2.4/site-packages/PyOpenGL-3.0.0a5-py2.4.egg/OpenGL/platform/__init__.py",
line 24, in ?
from OpenGL.platform.glx import *
File
"/usr/lib/python2.4/site-packages/PyOpenGL-3.0.0a5-py2.4.egg/OpenGL/platform/glx.py",
line 29, in ?
mode=ctypes.RTLD_GLOBAL
File
"/usr/lib/python2.4/site-packages/PyOpenGL-3.0.0a5-py2.4.egg/OpenGL/platform/ctypesloader.py",
line 37, in loadLibrary
return dllType( name, mode )
File "/usr/lib/python2.4/site-packages/ctypes/__init__.py", line 312,
in __init__
self._handle = _dlopen(self._name, mode)
OSError: No such file or directory
When this happens, self._name is "GL" and mode is 4. It would seem as
though somehow the GL library is not registered(?) with python? I'm at a
loss here - can anybody give me a hint? Has there been any successful
attempt at running PyOpenGL under cygwin?
I append a cygwin configuration dump.
Thanks,
Martin

Greg Ewing wrote:
> k0wax wrote:
>
>> How can I import all constants from OpenGL.GL without importing all
>> functions? (from OpenGL.GL import *)
>>
>
> Maybe something like
>
> g = globals()
> for name, value in OpenGL.GL.__dict__.items():
> if name == name.upper():
> g[name] = value
>
If the goal is just to get the constants (and you don't care about
loading the functions as you do so):
from OpenGL.raw.GL.constants import *
will work with PyOpenGL 3.x. You will, however, miss the "alias"
entries from the header file. You're also going to have all the
initialisation overhead of creating the functions, as they are created
when OpenGL.raw.GL is imported in importing the final module.
HTH,
Mike
--
________________________________________________
Mike C. Fletcher
Designer, VR Plumber, Coder
http://www.vrplumber.comhttp://blog.vrplumber.com

On 2/6/07, Mike C. Fletcher <mcfletch@...> wrote:
> Key thing is that we (somehow) have to register the PyOpenGL .egg
> directory (copied into the distribution directly) on the Python path.
> Once it's registered the setuptools mechanisms seem to correctly handle
> the entry point registrations. Py2exe doesn't, by default, process .pth
> or similar mechanisms for adding a directory, so we need to manually do
> it (i.e. in code). Possibly the py2exe people will know how to handle
> the registration more elegantly. Basically, I create a silly little
> "site.py" file with these contents in the dist directory:
>
> import sys, os
> sys.path.insert(
> 0,
> os.path.join(
> os.path.dirname( sys.executable ),
> 'PyOpenGL-3.0.0a5-py2.5.egg'
> )
> )
>
> exclude OpenGL from the py2exe project, include ctypes.* and weakref and
> then build. If my script does an "import site" before importing
> PyOpenGL I get a working PyOpenGL-bearing exe. More general solution
> would be to allow for a scan of the directory looking for the .egg
> files/directories and adding them to the path, but that seems like
> something that should be part of py2exe/py2app, rather than something
> PyOpenGL adds in. That should IIUC be pretty much the exact code in the
> regular site.py.
>
> Anyway, hopefully that will be enough to get you started. I'd love to
> see this problem fixed properly some day,
> Mike
>
> --
> ________________________________________________
> Mike C. Fletcher
> Designer, VR Plumber, Coder
> http://www.vrplumber.com
> http://blog.vrplumber.com
>
>
Thank you! Importing that script works fine!
I suppose I could remove the Demos dir and other not actually needed
dirs to make it a bit smaller, but that's not really important..
I really appreciate your help =D

Blake Winton wrote:
> Vasilis Platanias wrote:
>> I'm getting this strange problem when I try to bundle an opengl app :
...
>> and I get the same error.
>> I've also tried the --excludes=OpenGL option, and then adding the
>> entire OpenGL dir in the archive libraries, but with the exact same
>> results.
>> I suspect this is not a ctypes problem, but some kind of
>> initialization problem, because I've managed to recreate it with
>> c_uint and int in the place of c_ulong. There definitely should be a
>> type handler for c_uint or plain int..
>
> I got the same thing with py2app, and never did manage to get it
> figured out. If you come up with a solution I'ld love to hear about it!
>
> (I've also Cc:ed Mike Fletcher, the maintainer of PyOpenGL, on this
> email, since it seems like the sort of thing he'ld be interested in.)
I've just got a somewhat working version of an OpenGL project (just
dots.py from the Demos).
Key thing is that we (somehow) have to register the PyOpenGL .egg
directory (copied into the distribution directly) on the Python path.
Once it's registered the setuptools mechanisms seem to correctly handle
the entry point registrations. Py2exe doesn't, by default, process .pth
or similar mechanisms for adding a directory, so we need to manually do
it (i.e. in code). Possibly the py2exe people will know how to handle
the registration more elegantly. Basically, I create a silly little
"site.py" file with these contents in the dist directory:
import sys, os
sys.path.insert(
0,
os.path.join(
os.path.dirname( sys.executable ),
'PyOpenGL-3.0.0a5-py2.5.egg'
)
)
exclude OpenGL from the py2exe project, include ctypes.* and weakref and
then build. If my script does an "import site" before importing
PyOpenGL I get a working PyOpenGL-bearing exe. More general solution
would be to allow for a scan of the directory looking for the .egg
files/directories and adding them to the path, but that seems like
something that should be part of py2exe/py2app, rather than something
PyOpenGL adds in. That should IIUC be pretty much the exact code in the
regular site.py.
Anyway, hopefully that will be enough to get you started. I'd love to
see this problem fixed properly some day,
Mike
--
________________________________________________
Mike C. Fletcher
Designer, VR Plumber, Coder
http://www.vrplumber.comhttp://blog.vrplumber.com

pyOpenGL 3.0.0a5.
"OpenGL.GL.constants" contains basic conts like GL_BYTE
All other constants can be imported this way:
"from OpenGL.GL import GL_LINEAR"
How can I import all constants from OpenGL.GL without importing all
functions? (from OpenGL.GL import *)