I have a simple UI, no animations. Enabling G-SYNC for windowed applications and having focus in the window causes the mouse to be choppy when moving over the whole monitor. FRAPS shows that the window has ~2 fps.
A workaround is to cause repainting. Selecting text or resizing the window increases fps up to the monitor refresh rate (120 fps), which makes the movement look normal.
Using AnimationTimer produces 120fps, but also consumes CPU:
private boolean focus = false;
public void setStageAndSetupListeners(Stage stage) {
stage.focusedProperty().addListener((ov, onHidden, onShown) -> focus = ov.getValue());
AnimationTimer timer = new AnimationTimer() {
@Override
public void handle(long now) {
if (focus) {
label.setVisible(false);
label.setVisible(true);
}
}
};
timer.start();
}
I would like the JavaFX app to behave like any other desktop application - without consuming unnecessary CPU and not being choppy, or at least detect g-sync so that I can enable the workaround.
Win 10, GTX 980Ti, JDK 18
EDIT:
Workaround 2 (bad - font is mangled - screenshot):
-Dprism.order=sw
https://stackoverflow.com/a/18773007/685796
Workaround 3 (good - it seems fine):
-Dprism.forceUploadingPainter=true
http://werner.yellowcouch.org/log/javafx-8-command-line-options/
But it is only intended for testing and not recommended for production
source
Reported here: https://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8289505