pygame is
Python
Simple DirectMedia Layer
 
 
pygame.org is
Site Swing
Gloss

Gloss - 0.5

Paul Hudson (hudzilla)

Tags:

Description

The functionality most people will want to use in Gloss includes:

  • 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!

Links

Home Page: http://www.tuxradar.com/gloss
Source: http://www.tuxradar.com/files/gloss/gloss0.5.tar.gz

Releases

Gloss - 0.9 - Mar 28, 2010
Gloss - 0.85 - Jan 23, 2010
Gloss - 0.81 - Oct 22, 2009
Gloss - 0.8 - Oct 21, 2009
Gloss - 0.7 - Sep 30, 2009
Gloss - 0.6 - Jun 23, 2009
Gloss - 0.5 - Jun 8, 2009

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.
January 23, 2010 8:49am - Paul Hudson - nickname: (hudzilla) - 5/5
@Jordan Trudgett: try the new Gloss 0.85 release; particle systems run much faster now.
October 28, 2009 3:56pm - Jordan Trudgett - nickname: (tgfcoder) - 5/5
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 ?

gloss0.5/examples salagnac$ python example_rendertarget.py
Traceback (most recent call last):
File "example_rendertarget.py", line 41, in <module>
game.run()
File "/Users/salagnac/prog/python/pygame/gloss0.5/examples/gloss.py", line 145, in run
self.gloss_initialise()
File "/Users/salagnac/prog/python/pygame/gloss0.5/examples/gloss.py", line 119, in gloss_initialise
self.load_content()
File "example_rendertarget.py", line 9, in load_content
self.background = Texture("content/background.jpg")
File "/Users/salagnac/prog/python/pygame/gloss0.5/examples/gloss.py", line 515, in __init__
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, self.width, self.height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/PyOpenGL-3.0.0b6-py2.5.egg/OpenGL/wrapper.py", line 931, in wrapperCall
raise err
OpenGL.error.GLError: GLError(
err = 1281,
description = 'invalid value',
baseOperation = glTexImage2D,
pyArgs = [
GL_TEXTURE_2D,
0,
GL_RGBA,
1280,
720,
0,
GL_RGBA,
GL_UNSIGNED_BYTE,
'\x00\x00\x00\xff\x00\x00\x00\xff\x00...
],
cArgs = [
GL_TEXTURE_2D,
0,
GL_RGBA,
1280,
720,
0,
GL_RGBA,
GL_UNSIGNED_BYTE,
'\x00\x00\x00\xff\x00\x00\x00\xff\x00...
],
cArguments = (
GL_TEXTURE_2D,
0,
GL_RGBA,
1280,
720,
0,
GL_RGBA,
GL_UNSIGNED_BYTE,
c_void_p(116011028),
)
)
June 8, 2009 10:55pm - Ian Mallett - nickname: (geometrian)
Might want to look into more texture functionality (no filtering, mipmapping, anisotropy, etc.). I see you've found FBOs. Might also want to look into shader-based GPU particle systems (see my video: http://www.youtube.com/watch?v=Hm8ARVmbefQ). Nice examples.
June 8, 2009 12:22pm - Paul Hudson - nickname: (hudzilla)
@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.

Good luck!
June 8, 2009 12:13pm - Dylan J. Raub - nickname: (dylanjraub)
dude, pygame already has all this stuff... i think.
spotlight

 
our projects
pygame.org welcomes all python game, art, music, sound, video and multimedia projects. If they use pygame or not.
 
recent releases
Apr 21, 2014


Apr 19, 2014

Apr 16, 2014

Apr 13, 2014

Apr 9, 2014

Mar 18, 2014


Mar 15, 2014


Mar 14, 2014

Mar 13, 2014

... more!
 
for pygame related questions, comments, and suggestions, please see help (lists, irc)