I'm designing and implementing a Python OpenGL toolkit with fast 2D sprite support, very much like pyglet (yet with a completely different approach, for example with a lot of code written in C for speed).
But I'm really in the dark about what coordinate system to use. AFAIK most 2D libraries and software uses a top-left origin (with y increasing meaning going DOWN) while OpenGL uses a bottom-left origin by default. Also, AFAIK there are no performance arguments against either solution, since the conversion is trivial.
So what is the best origin for a 2D graphics library, bottom-left or top-left?
Critical library design question
It is an arbitrary convention. You might as well toss a coin.
I prefer +Y meaning UP, because it matches with standard mathematics. Then again, I like to use the centre of the screen as my origin, which I find convenient for doing small test programs (you need to do almost no work to get stuff drawn in the middle of the screen).
I prefer +Y meaning UP, because it matches with standard mathematics. Then again, I like to use the centre of the screen as my origin, which I find convenient for doing small test programs (you need to do almost no work to get stuff drawn in the middle of the screen).
You said it yourself, this is entirely subjective and neither is really better than the other. Just pick one and go with it.
If you're planning on having users who are already familiar with similar libraries it may be to your benefit to do the same as they do, although any half-decent programmer will have no trouble either way.
If you're planning on having users who are already familiar with similar libraries it may be to your benefit to do the same as they do, although any half-decent programmer will have no trouble either way.
- Jason Astle-Adams
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement