Getting the window position in P2D

Hello :slight_smile:
I want to get the window position of a window to if the window is offscreen correct it & correctly implement 3d movement (rotation with mouse). However, the versions i saw don’t work on P2D, P3D or any other renderer.
Does anyone know how to get the position?

There’s this very old sketch I’ve been working on but never finished:

But it has some techniques to capture the correct window type according to current canvas type.

This is the part where the generic window field is initialized:

public CanvasResizeWatcher(final PApplet pa, boolean now) {
  window = ( p = pa ).getSurface().getNative();
  pg = pa.getGraphics();
  immediate = now;
}

And the part where field window is cast to the specific datatype for OPENGL (P2D & P3D) as field win, which is Window:

public class SizeListenerOPENGL extends WindowAdapter implements SizeListener {
  public final Window win = (Window) window;
1 Like

Thanks, however i don’t know how to use this. Still thank you :smiley:

This came out for Processing3 (when surface replaced frame), it may work for getting the location:

As for setting it, use this: