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

Re: [pygame] PYGGEL reboot



The pyglet author remade the pyopengl interface in ctypes, which I seem to recall performs noticably faster than the wrapper that comes with pyopengl. This may be a valuable consideration in your choice of wrapper.

pyglet's batching is designed for 2D rendering, and was wasted on the old-style 3D primitives demos that I learned from. In essence I was using pyglet pretty much the same way I used pygame. I could not figure out how to leverage pyglet for shaders, so being a nub, I gave up.

For what it's worth, no opinions, just experiences.

Gumm

On 1/24/2015 2:39 PM, Sam Bull wrote:
On sab, 2015-01-24 at 21:23 +0100, Lucas Wagner wrote:
pyglet is both 2d and 3d.  Try the attached (if attachments are
allowed, otherwise consider the opengl example coming with pyglet) and
press F1, F2, and F3 to change between 2d (pygame-like), 3d isometric,
and 3d perspective views.
At a quick glance it appears that the only pyglet code in that example
is to setup an OpenGL context. The rest of the code is OpenGL, which is
what is actually drawing in 3D, and old-style (deprecated) OpenGL at
that.

It's interesting that pyglet appears to package OpenGL as a submodule
though.

I'm pretty sure that example would work identically if I changed the
couple of pyglet calls with calls to pygame. And changed the
'from pyglet.gl import *' import to 'from OpenGL.GL import *' in order
to use pyopengl directly.


Anyway, the important thing is that this example uses OpenGL directly.
The point of the discussed 3D graphic library is to provide a layer of
abstraction over OpenGL, to support loading models from files etc.

This way you would be able to load a model and draw it into a scene with
only a couple of calls. Rather than messing around with all the low
level OpenGL stuff.