On Nov 27, 12:44 pm, viper <[email protected]> wrote: > Hi, > > Some quick questions I hope someone will be able to answer for me: > > 1) What OpenGL functions are available in pyglet? Is there somewhere I > can look to see the complete list? > > 2) Does pyglet support OpenGL 4.1 functions? I found this > link:http://codeflow.org/entries/2009/jul/31/gletools-advanced-pyglet-util... > for a tool that apparently adds advanced functions to pyglet. Does > pyglet now encompass the functions of this tool? > > I'm trying to learn OpenGL. Since I know some basic python programming > I thought I'd try to learn OpenGL using python. Any help with the > above questions would be greatly appreciated. > > Cheers
To see the complete list of supported OpenGL functions supported by pyglet, you could look at the source code. Check out or browse the source code in Mercurial at http://code.google.com/p/pyglet/source. Alternatively, if you have installed pyglet, the source will already be in your Python directory, e.g. on Windows C:\Python27\Lib\site- packages\pyglet\gl.py. To find where it is on your system, start a Python prompt, and type: import pyglet pyglet.__file__ In that same directory, there will also be other modules containing the extra OpenGL stuff outlined in the pyglet.gl docs: http://www.pyglet.org/doc/api/pyglet.gl-module.html An alternative to using the pyglet OpenGL bindings is to use the PyOpenGL project. Happily this is dead simple in conjunction with pyglet - you can make a pyglet project as normal, but wherever you want to call an OpenGL function, you can simply import it from OpenGL.GL instead of from pyglet. The advantage of using PyOpenGL is that it is generally friendlier & more Pythonic than pyglet's OpenGL bindings - it performs error checking, making error diagnosis much easier. It performs type conversion of the parameters you pass it, meaning you, if you wish, often just pass simple Python lists instead of allocating ctypes arrays. The OpenGL functions offered by PyOpenGL are documented here: http://pyopengl.sourceforge.net/documentation/ The disadvantage of using PyOpenGL is that all the extra work it does for you makes it a little slower - in practice from 1.5 to 3 times slower than using pyglet's OpenGL bindings. However, this suggests a brilliant compromise: Use PyOpenGL for all your OpenGL calls to begin with. This will be easiest to code and get working. Then, if and when you want to optimise for performance, replace just the half-dozen OpenGL calls inside your innermost render loop with the pyglet bindings. This will give you the max performance, while still allowing you to use friendly PyOpenGL for 95% of your work. Cheers, Jonathan -- 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.
