Jump to content
Site Stability Read more... ×
  • Advertisement
Sign in to follow this  

OpenGL What features should a 2D graphics library have?

This topic is 2800 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am making a 2D graphics library in Python designed to make 2D easy and fast. Internally it uses OpenGL. The library does cover a bit more then a graphics library, it also includes windowing and sound (and all necessary features to get working, like texture loading).

I've got a good beginning working with good performance, and I'd like to expand and refine my feature set.

Now I'm wondering, what features should a 2D graphics library have? After some brainstorming I made a little list:

  • Fast sprite class for displaying rotated, scaled, colored and translated textures
  • Sprite batching
  • Drawing geometry: lines, polygons, circles, etc
  • Alpha with blending modes on all of the above
  • Easy texture loading (from file and memory)
  • Texture regions (and texture atlases)
  • Blitting texture(regions) into other textures
  • Particle systems
  • Off-screen rendering surfaces (FBO's?)

    But I feel I have only scratched the surface of features. What am I missing?

    One thing you must keep in mind that all of this in Python with C extensions. Any work in the library is fast, any work the user must do is relatively much slower. In addition to that Python calls are quite expensive, so the library largely benefits from batching.

    (In case anyone cares, the library in question is pygrafix and can be found here: http://github.com/nightcracker/pygrafix)

Share this post

Link to post
Share on other sites
Maybe more help to handle sets of sprites?
That is, the management of multiple sprites in the same texture with easy loading and accessing of named sprites, with optional animation.
Then tilemaps maybe?

Share this post

Link to post
Share on other sites
Texture masks perhaps?
Font support?

Personally I would recommend focusing your time on the texture loading and sprite batching, abstract all that away from the user as much as possible. In this day and age it would seem like the programmer/artist shouldn't have to deal with manually creating tilemaps/atlases for grouping commonly used assets (for performance purposes)... ie, there should be "no difference" between loading two different textures and loading one texture with both textures on it.

And depending on what your intent is, being able to specify the center-point in a sprite may be a good idea, among others, and things like that. Basically, I would personally focus on removing all of the house-keeping from the code and programmer. And if necessary, sacrifice a bit of performance if it significantly if it simplifies for the programmer, there's more than plenty of performance to go around for most reasonable 2D uses today.

But then again, it's about what your intent is, perhaps there should be two levels, the low-level and high-level API... but that may just be unnecessary abstraction and work too.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!