render2d coordinates

im trying to understand how the render2d coordinate system works. im especially trying to reconcile how DirectGui elements are positioned on screen.

The manual seems to contradict itself and it has me really confused. In one place it says:

“The coordinate system of render2d is set up to match that of the mouse inputs: the lower-left corner of the screen is (-1, 0, -1), and the upper-right corner is (1, 0, 1)”

Then in another:

“(Of course, in render2d almost all objects have a Z value of 0, so it doesn’t matter much.)”

the first quote implies the z coordinate of render2d goes left to right. the second implies that the z coordinate goes into the screen.

furthermore, all the documentation on directgui suggests z represents coordinates that are left to right. but in that case, why do objects have a z value of zero? are those coordinates relative to camera?

/confuse

That’s a typo in the manual. It should have said “almost all objects in render2d have a Y value of 0”. I’ve just made the correction.

For the record, the confusion comes about due to the different conventions of X, Y, and Z. In Panda’s default coordinate system, Y is forward and Z is up, and it is in this sense that the coordinates of render2d generally have a Y value of 0. But in OpenGL’s default coordinate system, Z is backward and Y is up, and this is the sense of Z that the original author of this page was thinking about when he wrote this text.

So, yes, Z goes from left to right, unless you switch to a different coordinate system.

David

thanks for clearing that up. i thought i was understanding things until i started reading those.