Gloss - 0.81

Paul Hudson (hudzilla)

Tags:

Description

Loading textures, then drawing them to the screen scaled, rotated, translucent and recolored in real time

Drawing text to the screen (yes, still with scaling, rotation, etc)

Particle systems for common special effects such as fire and smoke

Rendering scenes to a texture ("render targets") for complex effects

Built-in support for lerping, normalization and scene tinting

Easy API calls for anti-aliasing, screenshots, picking and more

Gloss is licensed under LGPLv3, and comes with full documentation, a tutorial and several code examples to help get you started, so if you're looking to make a game quickly and easily give it a try!

Changes

Optimised line and box drawing, modified the Texture() constructor so it accepts a path to a file or a Pygame surface, fixed bugs where lines would sometimes not be drawn and where grey lines sometimes appeared in boxes, and added a new example showing how to work with Pygame.

Pygame.org account Comments

If you wish to leave a comment with your pygame.org account, please sign in first.

June 5, 2010 7:40am - Jose - nickname: (midder)

Why gloss does not work on ubuntu 10.04? I tried it on Ubuntu 9.10 and worked perfectly. But now on ubuntu 10.04 when I try to ejecute it, nothing happends.

April 9, 2010 9:01am - David Griffin - nickname: (habilain) - 5/5

As a further note, I'm writing a library which uses glDrawRangeElements (and soon VBOs). Originally I was going to try and submit patches to Gloss, but the Gloss API itself turns out to be quite inefficient (specifically draw() methods tend to require too much data upload).

In any case, I have code for texture atlas's, batch rendering and a gloss Texture object which uses them (though there are slight difference in the color format and the way rotation works). If you'd like a copy to patch into Gloss, drop me a line at habilain - at - googlemail - dot - com.

April 1, 2010 5:51pm - David Griffin - nickname: (habilain) - 5/5

Excellent on the improvements. But there's a bug as mouse clicking doesn't dereference the weakref that you put in to fix the sprite memory leak, so it'll crash Gloss (try running example_onclick.py).

March 28, 2010 1:53pm - Paul Hudson - nickname: (hudzilla) - 5/5

David: thanks for the feedback! I just read through the updates on PyOpenGL3, and it's a bit disheartening to read "PyOpenGL 3.x is far slower than PyOpenGL 2.x, and PyOpenGL 2.x was not fast" - it's nice that the new version of the library is far slower :/

I've just put out Gloss 0.9. It adds the "OpenGL.ERROR_CHECKING = False" line as standard, and I believe also fixes the sprite memory leak you mentioned along with a couple of other changes. It seems to me the long-term performance fix here is to switch Gloss over to using glDrawArrays().

March 23, 2010 3:00pm - David Griffin - nickname: (habilain) - 4/5

Couple of points:

1) From looking at Gloss, it seems it's been designed to work with PyOpenGL2. At the very least, Ubuntu 9.10 has PyOpenGL3 in it's repo's, and Gloss has pretty abysmal performance with PyOpenGL3, especially "out of the box". This is due to massive changes in how PyOpenGL is written, and the fact that some old methods were depreceated in OpenGL 3.1, and hence these weren't considered import performance points of PyOpenGL3. As an example, best case performance of rendering 50 small balls in my tests was equal to normal Pygame. Worst case was an order of magnitude out.

2) Performance can be doubled under PyOpenGL3 by inserting the code

import OpenGL
OpenGL.ERROR_CHECKING = False

before importing Gloss.

And also a minor bug report: Sprites will not deallocate, because in __init__, the Sprite is added to the list Gloss.sprites. Supposedly, they are removed from this list in __del__, but __del__ is called when the GC collects the sprite, which it won't do because there will always be an active reference in Gloss.sprites. (Further, if __del__ is explicitly called by the user, then the GC will call it again, generating an exception because the sprite is no longer in the list of sprites). Solution would be to use Weakrefs or something.

In case I sound a bit too negative: I'm not trying to be. Overall I think this is a good library, but there's a couple of (I hope) valid points which should be made - especially the point about PyOpenGL3.

Just tried out the examples quickly, looks really great! The only thing that bugged me was that the particle demo got choppy when some effects exploded. This is without doing anything else on my quadcore 2.6GHz 4GB RAM + NVIDIA 9800 GT (1024MB) which worried me a bit. I'm keen on blaming OpenGL 3.0.0, because I've heard it's slower. I just don't know how much slower..

I haven't had a look at any code yet, I might a little later when I'm free :)
Great work so far though, it looks really promising! I tried to do something similar myself, but I kinda just made enough functionality to make my simple game then.. gave up xD

That non-power-of-two thing got me too. Haha.

October 9, 2009 1:17am - Joshua Worth - nickname: (yokljo)

Heh thats cool, very similar design to the C# XNA framework, except better in so many ways :D

June 25, 2009 11:41pm - Rene Dudfield - nickname: (illume)

Screen shot?

June 23, 2009 11:00am - Alexander Lupas - nickname: (adisander)

ok, I tried it on my Windows partion and it worked fine, so it's probably my OpenGL setting that are wrong. Thanks.

June 23, 2009 6:04am - Paul Hudson - nickname: (hudzilla)

Guillaume: it sounds like your GPU doesn't support non-power-of-2 textures, which is a bit annoying because even older Intel cards worked fine when I tested them! Still, I've released Gloss 0.6, which automatically converts non-power-of-2 textures to power-of-2 textures, which I hope will fix your problem.

Alexander: I'm not sure what's causing that. All the simple examples do are fire up OpenGL. If that doesn't work, it's more likely that your Python/OpenGL configuration is based. You'll find my email address in the Gloss download - you're welcome to get in touch and we can try and trace the problem.

June 14, 2009 6:50am - Alexander Lupas - nickname: (adisander)

I might be missing something, but when I try using Gloss (either the simple example from the tutorial, or any of the examples in the example folder), my computer doesn't show anything and starts using any CPU time it can get.

June 13, 2009 12:06am - Guillaume Salagnac - nickname: (gyom)

I would be very interested to try Gloss but on my system, gloss_initialise raises an exception, and I cannot run the examples. Did I miss something ?

@raubana: the "I think" addition to your comment says a lot. Of course Pygame does all that stuff, because Gloss is based on Pygame. The point of Gloss is that it makes it much easier and much faster. Gloss can rotate 1024x1024 textures in real time because it uses OpenGL. Unless you write your own routines, Pygame does everything on the CPU, which makes it incredibly slow for that sort of thing.

Please, try downloading the Gloss code, then see how long it takes you to do the particle system example or the render target example using just Pygame - that should give you a good idea of why Gloss is very helpful.