This works for me on Ubuntu -
import com.jogamp.newt.opengl.GLWindow;
void setup() {
size(640,480,P3D);
background(0);
GLWindow window = (GLWindow)surface.getNative();
window.confinePointer(true);
window.setPointerVisible(false);
}
void draw() {
stroke(255);
line(pmouseX, pmouseY, mouseX, mouseY);
}
Added draw()
or pressing ESCAPE
to close the window doesn’t work, and it’s useful to see where the mouse is.