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.
> 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/OldStyleRende rer.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.
I could not comment on installation issues since I am neither maintainer of pycollada nor experienced python developer.
Regarding daeview errors - you are right, there were couple of bugs when running on Mac OSX (I have no Mac and did not test on OSX). Nevertheless, with the help from Jeff Terrace these bugs are fixed now<https://github.com/pycollada/pycollada/pull/28>. Please pull the new version from git if you like to try it once again.
BTW, this example is now merged into the main pycollada repository<https://github.com/pycollada/pycollada>. So it is probably better to pull get the latest version from there.
>> 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/OldStyleRende rer.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.
Could you please try what Jeff suggested at the end of this thread<https://github.com/pycollada/pycollada/pull/28>? Probably he did not commit his changes yet but it should be easy to modify your local copy to see if it solves the problem.
> Could you please try what Jeff suggested at the end of this thread<https://github.com/pycollada/pycollada/pull/28>?
> Probably he did not commit his changes yet but it should be easy to modify
> your local copy to see if it solves the problem.
> Thanks,
> Andrey.
I don't have "Pillow" installed, so I don't see how that would be relevant
(?)
> Could you please try what Jeff suggested at the end of this thread<https://github.com/pycollada/pycollada/pull/28>? > Probably he did not commit his changes yet but it should be easy to modify > your local copy to see if it solves the problem.
Forget to say, that to display textures PIL should be also installed.
> Could you please try what Jeff suggested at the end of this thread<https://github.com/pycollada/pycollada/pull/28>?
>> Probably he did not commit his changes yet but it should be easy to modify
>> your local copy to see if it solves the problem.
> Forget to say, that to display textures PIL should be also installed.
Ah, yes, that looks a bit nicer, doesn't it? (attachment)
~ Nathan
Screen Shot 2012-09-20 at 4.29.20 PM.png
693K
Download
> Ah, yes, that looks a bit nicer, doesn't it? (attachment)
Now it looks exactly as it should be! :-) Glad that you finally get it running.
BTW, this file (cockpit) contains COLLADA animations for steering wheel and arrows. I am currently extending this example to support animation. I think it will considerably simplify development of the in-game user interface. For programmers, the only thing they will need to know is the name of the animation, for example, to rotate the steering wheel. How this animation will actually looks like is specified by 3D artist using corresponding animation support in Blender or whatever else 3D authoring tool.
Regarding the first repainting issue - without real investigation, I tend to say that it is an pyglet's OSX-specific issue since it works fine on Windows and Linux and do not see any reasons why the window is not updated after being shown. But it is a kind of speculation. I did not really investigate this particular problem yet.