Ability to choose 2D origin point

Could you make possible, via some function, to change 2D origin point to top left corner, instead of default bottom left? Of course default setting should remain bottom left, but some programmers are used to origin being in top-left corner of screen/window/whatever that such function would make computations necessary to position things right easier.



//edit: Of course I meant origin point used when positioning elements in GUINode.

Well opengl has that coordinate system. So why not just accept it. (But you could use a additinal node wich has your offset and translates the childs as you want if you really need that)

Oh. My. God. What “programmers” exactly you say don’t manage to understand a coordinate system? If its really so hard for you using height-y instead of y just make a method for that yourself. :facepalm:

Seriously, this does come off a bit like “I’m new to graphics programming and would rather have the world reorient itself to me instead of just learning the way the world works.”



If you want to see why this is not as trivial as it seems:

guiNode.setLocalTranslation( 0, cam.getHeight(), 0 );

guiNode.setLocalScale( 1, -1, 1 );



Then make users stand on their heads to read the text and stuff.

Then flip the screen.

You can layer whatever math on top of the GL coordinate system that you want. If you want it to be top left then it would be pretty trivial to get the size of the screen at application start and create an offset for the Y point. Done.

Yeah, but if it is so trivial, why don’t built it in? Also by “Some programmers” I meant QT, SDL, Allegro, LOVE, Delphi, Swing, Win32 and many other libs programmers. In nearly all libs 2d origin point is located in top-left, only libs that does it differently are LWJGL and JME. You can compare this strange behavior to Blender’s “Let’s have Z axis for height” quirk.



//edit: Of course old behavior should remain and be default for compatibility reasons, but it should be able to get selected by setter in either guiNode or viewPort.

@dariuszg-jagielski said:only libs that does it differently are LWJGL and JME.


No. This is an OpenGL specification.

See page 42: http://www.opengl.org/registry/doc/glspec20.20041022.pdf

That’s funny - because OpenGL is for 3D things and we are talking about 2D origin point, not 3d one.



//edit: And where are you exactly on page 42 seeing that 2d origin point is in bottom-left? I don’t see anything like “2D origin point (0,0) is in bottom-left”.

This is not a trivial change to make. Far more trivial to adjust your own code and thinking to match what reality is.

OpenGL is for anything accelerated, but it all ends up as 2D being sent to the screen. Everything in your jME scene is getting rendered via GL.

I hate double posting but:

@dariuszg-jagielski said://edit: And where are you exactly on page 42 seeing that 2d origin point is in bottom-left? I don't see anything like "2D origin point (0,0) is in bottom-left".


Viewport transformation parameters are specified using
void Viewport( int x, int y, sizei w, sizei h );
where x and y give the x and y window coordinates of the viewport’s lower left
corner and w and h give the viewport’s width and height, respectively. The viewport
parameters shown in the above equations are found from these values as ox =
x + w/2 and oy = y + h/2; px = w, py = h.

… cutting out this nonsense … two core devs trying to explain the reason for a coordinate system :facepalm: