frame + setPos

I want to create some draggable frame in my program. The “draggable” thing was easy thanks to the forum. But I got a small problem : what are the coordinates bounds for a frame ?

I thought that the coordinates system used for the frame is [-1,1]x[-1,1], with the (0,0) point right in the center of the screen

But if F is a frame, F.setPos(-1,0,1) does not put the frame in the top left corner. The top left corner of the frame is a little above the top border of the window, and a little on the right of the left border.

I don’t understand how it works at all. Could someone explain what are the boundaries of the coordinate system and how this whole thing works ? Or give some tracks I could follow so that I can figure it out myself.

Thanks in advance.

It must be exactly on the top border, as long as you don’t change it’s scale.

Sure, aspect2d (the parent of DirectFrame by default) coordinate space is (-windowAspectRatio,windowAspectRatio) x (-1,1).
This is the truth proof :

Never mind the apparent position in that pic, the actual aspect2d is the area fully covered by the grid (it’s when it was scaled down and shifted due to zooming). As you can see, the Z position is 1, exactly on the top border.
If you’re using the default main window, you can get it’s aspect ratio :


Or you can place the frame relative to render2d, whose coordinate space is (-1,1)x(-1,1) :


The result, exactly on the upper left corner :

Great explaination ynjh_jo. The images really help convey the idea as this is something I was trying to do as well.

As for terminology , when a “draggable frame” is mentioned in this post is it reffering to a “draggable window” such as drop-downs,… etc…? Thanks again.

I guess it must be this :

Thanks a lot ynjh_jo ! It really helps me a lot.