Skip to main content
GameDev.net gamedev.net
🔒 Locked

Different coordinates systems

Started by MajinMusashi Sep 20, 2005 at 12:40 AM 4 replies 850+ views
Original Post
MajinMusashi
MajinMusashi
Hi! I'm actually designing a GUI system using C++, SDL and OpenGL, and I'm a bit confused about the different coordinates systems of those libraries: SDL - origin at top-left OpenGL - origin at bottom-left IDE's like Borland Delphi - origin at top-left Knowing I can't change only the SDL coordinates system origin, will it be a good idea to make everything start at bottom-left (including my GUI)? This way, I'll only need to do some conversion at the SDL mouse events. Thanks a lot!
MajinMusashi
MajinMusashi
It's really confusing for me to think on a GUI with (0,0) at bottom-left after so many years of Delphi programming :)
Goodbye!
Drew_Benton
Drew_Benton
Quote:
Original post by MajinMusashi
Knowing I can't change only the SDL coordinates system origin, will it be a good idea to make everything start at bottom-left (including my GUI)? This way, I'll only need to do some conversion at the SDL mouse events.


Is your GUI in 2D using OpenGL? If it is, then you don't have to worry about SDL's coords because you are rendering in OpenGL. For that it's just a matter of setting up the Ortho function to start at either the top left or bottom left, depending on how you want it. I made my OpenGL start at top left [wink].
MajinMusashi
MajinMusashi
Quote:
Is your GUI in 2D using OpenGL? If it is, then you don't have to worry about SDL's coords because you are rendering in OpenGL. For that it's just a matter of setting up the Ortho function to start at either the top left or bottom left, depending on how you want it. I made my OpenGL start at top left [wink].

Yes, my GUI is 2D using OpenGL. Actually I'm using orthogonal projection and top-left origin, but I'm almost sure the games that will use this GUI will start at bottom-left. Oops, forgot to tell, my home made text rendering library starts at bottom-left too :(
Can you see the problem? Each component has its own orientation :) Or I'll get crazy or I'll have to rewrite almost everything to match a standard.
Drew_Benton
Drew_Benton
Ahh yes, I see what you mean. Well in that case, do you think you could make all your code be 'coordinate independent'? Perhaps you make it so the user can use the code in either setup and it displays right? Not sure if it's worth the effort, but you could try accodomating everyone [wink] Whatever you choose though, good luck!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.