Skip to main content

PyGL3Display - 1.9-alpha7

PyGL3Display is a high performance, OpenGL, 2D sprite library for Python/Pygame with a simple API not too dissimilar to Pygames. It requires slightly more recent hardware than other libraries, but it is "breaks the Pygame FPS counter" fast*.


David Griffin
(habilain)

2.0 will be the final version of PyGL3Display

I've been looking through PyGL3Displays code with the intention of implementing proper Z-ordering and have come to the conclusion uncovered that a) PyGL3Display would likely need some major API-breaking work to implement Z-ordering in any sane manner and b) there's a fair amount of other use cases which PyGL3Display, in it's current form, simply cannot do (e.g. multiple windows)

Hence the choices are either a backwards incompatible release or to put PyGL3Display in maintenance only mode and move to another project. I've chosen the latter; apologies to anyone that this inconveniences. - David

PyGL3Display is a high performance, OpenGL, 2D sprite library for Python/Pygame with a simple API, not too dissimilar to Pygames (There's an API compatible Image object, and Sprites are not too dissimilar). It requires slightly more recent hardware than other libraries, but it is "breaks the Pygame FPS counter" fast*.

License: GPL v2 / v3. Commercial licenses are negotiable - at least on parts which I have copyright on (as I am open to outside contribution).

Requirements: Python 2.x, Pygame, PyOpenGL, OpenGL 2.0 compliant system

On Linux only: CFFI can replace PyOpenGL

Not yet compatible with Python 3

Main Design:

1. Near optimal performance.

2. Use GPU shaders as much as possible, as Python programs are much more likely to be CPU bound.

3. Clean, easy to use "normal" API, which also has an advanced mode for people who want the absolute maximum in performance and don't mind getting their hands dirty. For normal use, the API should not be any more difficult to use than Pygame.

* "Breaks the Pygame FPS counter" fast: On my Phenom II based system, the text demo, which draws a not inconsiderable amount of text, jumps between 3333.33 FPS and 5000 FPS according to a Pygame clock object. A hand written FPS counter indicates the real FPS is about 4200. On a much older system (Pentium 4), PyGL3Display still manages 666.66 FPS according to Pygame clocks - which again, seems like I'm hitting some accuracy limit in floating points.

Note: Questions, bug reports etc. are all best done through Launchpad, because that way I'll get notified quickly.

Links

Home Page
https://launchpad.net/pygl3display
Source
https://launchpad.net/pygl3display

Releases

PyGL3Display 1.1 — 22 Sep, 2011

PyGL3Display 1.02 — 25 May, 2011

PyGL3Display 1.9-alpha — 17 Jan, 2012

PyGL3Display 1.9-alpha2 — 18 Jan, 2012

PyGL3Display 1.9-alpha3 — 4 Feb, 2012

PyGL3Display 1.9-alpha4 — 31 Mar, 2012

PyGL3Display 1.9-alpha6 — 28 Apr, 2012

PyGL3Display 1.9-alpha5 — 20 Apr, 2012

PyGL3Display 1.92 — 22 Oct, 2012

PyGL3Display 1.9-alpha7 — 29 May, 2012

PyGL3Display 1.9-alpha8 — 2 Jul, 2012

PyGL3Display 1.9-beta1 — 25 Jul, 2012

PyGL3Display 0.9 — 4 Apr, 2011

PyGL3Display 1.0 — 3 May, 2011

PyGL3Display 2.0-alpha1 — 22 Mar, 2013

PyGL3Display 1.9-beta2 — 26 Aug, 2012

PyGL3Display 1.9 — 10 Sep, 2012

PyGL3Display 2.0 — 28 Nov, 2013

Pygame.org account Comments

  • }

    schnappus 2011-05-04 18:36:36

    I'd love to give it a try, but I can't do anything with the downloaded file.
    I'm running Windows 7.

  • }

    David Griffin 2011-05-10 22:43:20

    Hmm... Yes. It does seem I've picked one of the more rare archive formats. I'll see what I can do about getting a ZIP version up at some point.

  • }

    renesd 2011-05-23 11:16:17

    Hi,

    this looks very cool!

    I get an error when I tried it though.   I think because my laptop does not support 16k textures in glTexImage2D.  Here's the error: http://pastebin.com/UPiHM3EZ

    }

    David Griffin 2011-05-25 16:02:35

    Weird. That call is only supposed to be checking the capabilities of the graphics card (hence GL_PROXY_TEXTURE_2D rather than GL_TEXTURE_2D) and really should not raise any error - at least that's what I understand from the GL docs. When I get a chance I'll put some try/excepts around it and hopefully that'll make it better.

    For reference, what OS/Graphics are you using?

    EDIT: I've now released an attempted fix. Hopefully it works for you; I'm afraid I'm a bit blind on this as I haven't yet been able to recreate the problem.

    }

    renesd 2011-05-26 07:11:50

    it works now. old macbook pro with ATI RadeonX1600 graphics.

    }

    David Griffin 2011-05-26 07:58:23

    Excellent.

  • }

    Saluk64007 2011-06-22 07:29:34

    Out of memory error:

    http://pastebin.com/8R7F5BhE

    }

    David Griffin 2011-06-26 18:21:45

    Looks like another slightly dodgy driver issue... Apparently, the driver reported that it could create a texture, only to then fail when creating the texture. I'll see if I can cook up some kind of fix in the near future...

    Could you post your OS/Graphics card please? This might help me narrow down what's going on.

    }

    David Griffin 2011-09-23 01:05:01

    Theoretically at least, this bug should now be fixed. As I was unable to reproduce it, I'm waiting to see if it actually is fixed.

    }

    Saluk64007 2012-02-05 19:08:53

     Seems to be fixed!

  • }

    Jouni Järvinen 2012-04-01 11:34:08

    Good stuff, man.

    A tip: anything between any matching pair of brackets won't need the explicit skipping of newline. Meaning lines like

                    dict([(key, [shader.arrayLocs[key]] + self.arrays[key][1] + \
                          [self.arrays[key][0]]) for key in self.arrays if key in \
                          shader.arrayLocs])

    won't need the '\' since they're already between a pair of brackets, many of them in fact.

    }

    David Griffin 2012-04-05 11:32:06

    I know that. But when I was going through with PyLint, I was kind of on autopilot for a the tedious long lines part. It'll get corrected when I go back over the code for the full 1.9 release - there's a lot of other stuff along those lines that needs fixing.

    }

    Jeremy Gagnier 2012-07-28 01:35:00

    When I code I use them anyways. I feel like it's a good habit in case something doesn't happen to be inside brackets. There's no performance loss with them, so why not?

  • }

    g4borg 2013-03-19 23:08:22

    i will try this out with my 2d engine, since i was thinking about writing my own. looking forward to it. i would prefer a different project page tho, some RST readme in the repo and moving it to github/bitbucket or similar would benefit this size/kind of project.

    }

    David Griffin 2013-03-27 22:51:19

    RST docs might happen at some point. Not sure about a different project page - as in not entirely certain what you mean - but at some point in the future I will be making a proper website. Github/Bitbucket probably won't happen, because I use Bazaar for VCS. I am curious about how Github/Bitbucket could benefit a project based on its size though...

  • }

    Jorge de Assunção Gomes 2013-10-12 18:13:42

    installer?

    }

    David Griffin 2013-10-12 18:21:07

    None at present :(

    Real life kept me from this project for a while, but I'm back to working on it now. There will be an installer + pip functionality for the full 2.0 release, which I'm hoping to do before the end of next month, if not this month.

    For now, just unzip into your project directory.