On Tue, Sep 18, 2012 at 2:28 PM, Andrey Nechypurenko
<andre...@googlemail.com> wrote:
Hi Folks,
I am currently working on the project where it is necessary to visualize COLLADA (DAE) files. For these purposes I decided for pyglet OpenGL wrappers and pycollada (which is the library to read collada files). To learn how to do it I have made an example and just want to let pyglet community know about it. Maybe it could be useful for somebody.
The example has two renderers - the old-style which uses OpenGL display lists and the modern-style which uses GLSL shaders and VBOs (with pyglet's batches). So to some extent, it could be also considered as an example how to visualize 3D models with pyglet using modern OpenGL techniques.
Regards,
Andrey.
Looks interesting--but it doesn't work for me. :-( Here's my experience:
1) 'python setup.py install' for pycollada failed trying to automatically install numpy
2) I installed numpy myself: 'pip install numpy'
3) Then installing pycollada worked.
4) examples/daeview.py crashed with this output:
daeview $ python daeview.py
Creating display list...
It could take some time. Please be patient :-) .
diffuse = Texture speedometr_bmp: (not available)
diffuse = Texture compas_bmp: (not available)
diffuse = Texture speedometr_bmp: (not available)
diffuse = Texture earth2_jpg: (not available)
done. Ready to render.
Traceback (most recent call last):
File "daeview.py", line 69, in <module>
pyglet.app.run()
File "/Users/nathan/.pythonbrew/pythons/Python-2.7.3/lib/python2.7/site-packages/pyglet/app/__init__.py", line 123, in run
event_loop.run()
File "/Users/nathan/.pythonbrew/pythons/Python-2.7.3/lib/python2.7/site-packages/pyglet/app/base.py", line 127, in run
self._legacy_setup()
File "/Users/nathan/.pythonbrew/pythons/Python-2.7.3/lib/python2.7/site-packages/pyglet/app/base.py", line 218, in _legacy_setup
window.dispatch_pending_events()
File "/Users/nathan/.pythonbrew/pythons/Python-2.7.3/lib/python2.7/site-packages/pyglet/window/cocoa/__init__.py", line 322, in dispatch_pending_events
EventDispatcher.dispatch_event(self, *event)
File "/Users/nathan/.pythonbrew/pythons/Python-2.7.3/lib/python2.7/site-packages/pyglet/event.py", line 355, in dispatch_event
if handler(*args):
File "daeview.py", line 26, in on_draw
daerender.render(window.rotate_x, window.rotate_y, window.rotate_z)
File "/Users/nathan/proj/extra/pycollada/examples/daeview/renderer/OldStyleRenderer.py", line 180, in render
glCallList(self.displist)
File "/Users/nathan/.pythonbrew/pythons/Python-2.7.3/lib/python2.7/site-packages/pyglet/gl/lib.py", line 105, in errcheck
raise GLException(msg)
pyglet.gl.lib.GLException: invalid operation
5) So I switched the renderer in daeview.py to "GLSLRenderer" by swapping the commented renderer lines as instructed, and got this crash:
daeview $ python daeview.py
Running with OpenGL version:
Traceback (most recent call last):
File "daeview.py", line 63, in <module>
daerender = renderer.GLSLRenderer(collada_file)
File "/Users/nathan/proj/extra/pycollada/examples/daeview/renderer/GLSLRenderer.py", line 48, in __init__
print 'Running with OpenGL version:', glutils.getOpenGLVersion()
File "/Users/nathan/proj/extra/pycollada/examples/daeview/renderer/glutils.py", line 13, in getOpenGLVersion
return cast(versionString, c_char_p).value
NameError: global name 'cast' is not defined
I'm using pyglet 1.2dev (completely up-to-date tip of the hg repo), python 2.7.3 installed via pythonbrew, on OS X 10.8.1.
~ Nathan