Playing with extensions in PyOpenGL

Have been spending the afternoon doing a bit of cleanup in the later extensions and versions for OpenGL in PyOpenGL.  Many of the later OpenGL versions do most of their work by importing entry points and constants from ARB extensions.  That's now reflected in PyOpenGL so that the core GL namespace includes those extension entry points/constants.

It doesn't seem practical to support the OpenGL-ES fixed-point formats (there's no support I can see in Numpy or ctypes, so I'd have to implement a lot of machinery that would likely be slower than using floats), so we'll be common-profile only there.  Other than that most of the ES compatibility stuff seems to be straightforward enough to "just work".

I added some code to the OpenGL.GL.shaders module to make binary-format retrieval of the compiled shaders easier and allowing separable shader compilation with the convenience wrappers.  The binary format is intended to allow for creating caches for the local machine instead of always re-compiling your shaders.  It's not likely to be useful for inter-machine use (or even long-term storage), from what I read.

I also wrote a few test cases for certain extensions.  Nicest one was testing ARB draw_instanced, which lets you render parameterized geometry.  200 per-pixel textured, lit, high-polygon spheres (total of 790,000 triangles) with multiple lights at ~ 250fps on my laptop with minimal CPU load (~25% of one CPU).  Needs more parameterization to be an interesting tutorial, but it's still nice to see it "just work".  Of course, when I try 2000 instances py-malloc fails, so there still may be some work required to get the endless fields of grass tutorial written.

Comments

Comments are closed.

Pingbacks

Pingbacks are closed.