Jump to content

  • Log In with Google      Sign In   
  • Create Account


What features should a 2D graphics library have?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 nightcracker   Members   -  Reputation: 142

Like
0Likes
Like

Posted 15 February 2012 - 04:41 AM

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)

Sponsor:

#2 nightcracker   Members   -  Reputation: 142

Like
0Likes
Like

Posted 16 February 2012 - 08:10 AM

Anyone?

#3 Olof Hedman   Crossbones+   -  Reputation: 2766

Like
0Likes
Like

Posted 17 February 2012 - 01:49 AM

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?

#4 Syranide   Members   -  Reputation: 375

Like
0Likes
Like

Posted 17 February 2012 - 05:37 AM

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.



#5 Waterlimon   Crossbones+   -  Reputation: 2515

Like
0Likes
Like

Posted 19 February 2012 - 05:42 AM

Perhaps a bunch of special effects that can be applied?

o3o





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS