As I am quite used to screen geometry, where 0,0 is at the top left corner or the screen (as it is for just about every desktop app and Web app in the world), but I find it very hard to actually implement a UI in OpenGL since it's coordinate system is vertically inverted from what I have always worked with.

I'm trying to implement a GUI for a plugin for the game Rising World, and this is driving me crazy.

The added restriction that I have is that I do not have access to the actual screen resolution, but can only achieve full screen width and height using relative positioning and size (from 0 to 1). Sure, I can use pixels to position shapes and controls, but I cannot say, for example : place this at 50% - 20 pixels; it is either one or the other per shape.

I am Googling for things I can read about UI design with "inverted" Y coordinates (i.e. since we read from top to bottom, it is inverted to me), but I can't find anything relevant. And since I cannot use any third party GUI library but what the game is offering, I am restricted to basic shapes and positioning (i.e. doing things 100% manually).

Is there a way in this context that I can author my UI in a coordinate system where the origin is the top-left?

  • \$\begingroup\$ Unfortunately questions asking for links to resources, etc, are considered too broad here. But we can probably address your specific problem if you reword the question slightly. Do you just want to know how you can effectively "invert" the "inverted" coordinate system back to what you want? \$\endgroup\$ – Josh Jan 4 '18 at 18:26
  • \$\begingroup\$ I expected this question to be closed or put on hold. I don't ask any question on SO or StackExchange anymore because of it. It was once because it would be subject to debates, but it has degenerated to any "We do not know how to answer, so we will close this". I am not sure how I can rephrase this more clearer without adding a few more paragraphs, and definitely have this question flagged and closed for being "too specific". :/ \$\endgroup\$ – Yanick Rochon Jan 4 '18 at 18:29
  • \$\begingroup\$ Unless a question is "debug this crash for me" and does not include a minimal reproducible example, we don't generally close things for being "too specific." If you can provide paragraphs containing more detail about the specific thing you'd like to achieve and what difficulty you're having trouble with -- as opposed to just asking for general "resources," that would almost certainly make for a question that's on-topic here. \$\endgroup\$ – Josh Jan 4 '18 at 18:32
  • 1
    \$\begingroup\$ For example if your real concern really is "this game uses GL's inverted coordinate system, I'd like to author my UI stuff in a non-inverted system, how can I achieve that?" that's perfectly on-topic here. \$\endgroup\$ – Josh Jan 4 '18 at 18:42
  • \$\begingroup\$ That's pretty much what I wrote, I simply stated which game I'm using because I know by experience that this RFI would've come up in the comments. \$\endgroup\$ – Yanick Rochon Jan 4 '18 at 21:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.