From 54fba5da9e85ecacb39ed825d4434865ecacb7b2 Mon Sep 17 00:00:00 2001 From: codeanticode Date: Tue, 13 Feb 2018 02:13:45 -0500 Subject: [PATCH] cap framerate at 1000 in OpenGL --- core/src/processing/opengl/PSurfaceJOGL.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/core/src/processing/opengl/PSurfaceJOGL.java b/core/src/processing/opengl/PSurfaceJOGL.java index dd7a1d767..17d2d916e 100644 --- a/core/src/processing/opengl/PSurfaceJOGL.java +++ b/core/src/processing/opengl/PSurfaceJOGL.java @@ -815,8 +815,15 @@ public class PSurfaceJOGL implements PSurface { public void setFrameRate(float fps) { if (fps < 1) { - PGraphics.showWarning("The OpenGL renderers cannot have a frame rate lower than 1.\nYour sketch will run at 1 frame per second."); + PGraphics.showWarning( + "The OpenGL renderer cannot have a frame rate lower than 1.\n" + + "Your sketch will run at 1 frame per second."); fps = 1; + } else if (fps > 1000) { + PGraphics.showWarning( + "The OpenGL renderer cannot have a frame rate higher than 1000.\n" + + "Your sketch will run at 1000 frames per second."); + fps = 1000; } if (animator != null) { animator.stop(); @@ -1220,7 +1227,7 @@ public class PSurfaceJOGL implements PSurface { } static Map cursors = new HashMap<>(); - static Map cursorNames = new HashMap(); + static Map cursorNames = new HashMap<>(); static { cursorNames.put(PConstants.ARROW, "arrow"); cursorNames.put(PConstants.CROSS, "cross");