Sketch GUI in different Operating Systems

Hello !

Alright so I’ve been trying to work with OpenGL recently, writing and executing shaders… But another issue that I’m facing is that having a resizable P2D sketch isn’t actually that simple, the resizing is very buggy (as was mentioned in other posts I’ve seen) and on top of that, it seems that the mouse cursor icon isn’t changed to the usual resizing arrows. This is why my only solution is to hard code the resizing cursor icon (as in, hard coded the 7px of manipulable border around the whole sketch, hard coded the dimension of the top right “minimize/close” buttons…).

My question is : the sketch GUI is OS-dependent right ? As in if I was to run this sketch on Mac or Linux, the dimensions of each element (border width, top-right buttons width…) would be different ? If so is there any way to algorithmically know when the cursor is in the border of the sketch where resizing is possible ?

I’ll also add here that fore some reason after a certain amount of time, on the P2D sketch, the cursor() function simply seems to stop working… I’ll try investigating but to me this doesn’t make sense, I know that the function is called and it works perfecly fine for the first 30s…

Thanks for your help :slight_smile:

It is possible to get the widths on the window frame and this might be a starting point. On my iMac a P2D window only has a top border. Anyway I used this sketch to get the window border widths so you could use it to try some ideas to manage resizing.

I also experienced problems with using cursor() in OpenGL which I discovered when updating G4P. I reported the issue just over 2 years ago, it might not be related to your problem but I thought you might be interested.

com.jogamp.newt.opengl.GLWindow window;
com.jogamp.nativewindow.util.InsetsImmutable insets;

void setup() {
  size(600, 400, P3D);
  window = (com.jogamp.newt.opengl.GLWindow) surface.getNative();
  insets = window.getInsets();

void draw() {
  text("Top:      " + insets.getTopHeight(), 10, 40);
  text("Bottom:   " + insets.getBottomHeight(), 10, 80);
  text("Total height: " + insets.getTotalHeight(), 10, 120);
  text("Left:     " + insets.getLeftWidth(), 10, 160);
  text("Right:    " + insets.getRightWidth(), 10, 200);
  text("Total width: " + insets.getTotalWidth(), 10, 240);
  text("Mouse ("+ mouseX + ", " + mouseY +")", 10, 280);

Hmmm… It seems to me that although Processing is quite stable from afar, when trying to work with OpenGL it can be quite unstable and a few things seem to break (not only cursor, but also shader application…).

I’ll try to modify my code to work with JOGL directly, it might be more stable.