OpenGL API Specifications
Documents and Learning ResourcesSupport Libraries and FrameworksFunction Libraries and GeneratorsThis list contains some basic resources for getting started with, and developing for, OpenGL 3.0 and onwards. Contact your forum moderator if you want to contribute to the list or have any comments.Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.
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.
Posted 08 November 2012 - 09:47 AM
Posted 08 November 2012 - 10:06 AM
Posted 09 November 2012 - 01:14 AM
Posted 09 November 2012 - 12:12 PM
Let's just focus on the meaning of one pair of parameters, the other two pairs work the same. Let's take the bottom and top parameters as an example since you're talking about the Y-axis.
The function in itself is used to specify the visible coordinate range for your screen (actually, for the viewport, but let's say the viewport covers the whole screen). That is, the value of the bottom parameter specifies the Y-coordinate corresponding to the bottom edge of the screen, and the top parameter specifies the Y-coordinate corresponding to the top of the screen. So if you specify bottom as 0 and top as 100, then everything that has a Y-coordinate between 0 and 100 will appear on the screen, where 0 is the bottom, 50 is in the middle and 100 is at the top.
So to invert the Y-axis, just swap the bottom and top parameter values. Thus, if you specify bottom as 100 and top as 0, then you have your inverted Y-axis since 0 now corresponds to the top of the screen and 100 to the bottom of the screen.
But that may or may not be the solution you're after. You're also taking about the problem being the mouse cursor, so it could very well be that a bottom-to-top coordinate is what you actually want, but that you just want to invert the actual mouse coordinate. In that case, just subtract the height from the mouse's Y-coordinate: y=height-1-y.
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.
GameDev.net™, the GameDev.net logo, and GDNet™ are trademarks of GameDev.net, LLC.