Often they are similar enough to be a drop-in replacement. On my
recent project, for several weeks I could switch from one to the other
just by changing the imports.

For some OpenGL functions though, there are differences. For me, there
have been two causes for this:

Firstly, some OpenGL functions ask for, or return, an array of values.
In pyglet, these arrays must often be created as a ctypes array, and
then passed to OpenGL as an appropriate pointer type, just as you
would in C. In PyOpenGL, these functions have often been Pythonified,
so that they (for example) simply accept a Python list of integers or
strings - no ctypes required.

I've tried to find a representative example of the ctypes wrangling,
to give you an idea what it involves. Often it's as simple as casting
an argument to a ctypes type:

    from pyglet.gl import *
    from ctypes import c_uint, byref
    fb = c_uint()
    glGenFramebuffersEXT(1, byref(fb))

Versus something like:

    from OpenGL.GL import *
    buffer_id = glGenFramBuffersExt(1)


On Mar 21, 1:06 pm, Will <[email protected]> wrote:
> Just wondered how PyOpenGL is easier to use than pyglet? I thought
> they were pretty similar?
>
> On Mar 20, 10:53 am, Jonathan Hartley <[email protected]> wrote:
>
> > On Mar 19, 10:44 am, hugo <[email protected]> wrote:
>
> > > Hello,
>
> > > I'm using pyOpenGL instead of pyglet.gl. Is disabling error checking
> > > with "OpenGL.ERROR_CHECKING = False" sufficient or/and should I use
> > > "pyglet.options['debug_gl'] = False"?
>
> > > Thank you,
>
> > > HG.
>
> > Hey.
>
> > I already asked a question much like this on 
> > pyopengl-users:http://sourceforge.net/mail/?group_id=5988
>
> > Mike Fletcher himself responds that it is not sufficient, and details
> > some other things you should do. but even after doing everything
> > possible one should still not expect the same performance as pyglet's
> > bindings.https://sourceforge.net/mailarchive/forum.php?thread_name=4CF3F8CE.20...
>
> > As a result, I have started using PyOpenGL during development, for
> > ease of use, and then when optimising I replace the half-dozen OpenGL
> > calls in my inner render loop with pyglet bindings. This generally
> > gives me at least double the framerate.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en.

Reply via email to