Violating my own principle in PyOpenGL sometimes works

As I've been listening to PyCon lectures in the background as I work, I'm struck by the number of times people discussing PyOpenGL refer to the OpenGL.array.vbo module positively.  It's actually one of those pieces of the API where I have broken one of my rules for the project; "Don't extend the API".

Over the years (and it has been over a decade I've been maintaining this project) we've seen these convenience wrappers become problems, everything from the undecorated glColor, glMaterial etc. functions to the "contiguous( array )" calls that we exposed.  They were always good ideas at the start, and they almost always wind up leaving us with an abstraction headache years down the line.

The "OpenGL.GL.shaders" module is a similar extension.  But I don't want to remove it either (I have no intention of removing VBO objects any time soon).  Without those abstractions it is a PITA to try to write demo/tutorial code for OpenGL.  But with them, PyOpenGL has both the core API and a poorly documented slightly higher level API.

In retrospect I likely should have created a second (tiny) package for those features.  OpenGL's array handling is pluggable, after all, and the shaders module is just regular OpenGL calls that choose among alternates... but it's hard to see that when you are in the heat of coding up tutorials for hot-new features and just can't imagine anyone using such a mess of code just to say "put this data over there" or "make this a shader".  I suppose this is just a risk of wrapping an "append only" API.


Comments are closed.


Pingbacks are closed.