Skip to content

Commit 8ff6fb6

Browse files
committed
cap framerate at 1000 in OpenGL
1 parent f54ee98 commit 8ff6fb6

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

core/src/processing/opengl/PSurfaceJOGL.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -815,8 +815,15 @@ public void setSmooth(int level) {
815815

816816
public void setFrameRate(float fps) {
817817
if (fps < 1) {
818-
PGraphics.showWarning("The OpenGL renderers cannot have a frame rate lower than 1.\nYour sketch will run at 1 frame per second.");
818+
PGraphics.showWarning(
819+
"The OpenGL renderer cannot have a frame rate lower than 1.\n" +
820+
"Your sketch will run at 1 frame per second.");
819821
fps = 1;
822+
} else if (fps > 1000) {
823+
PGraphics.showWarning(
824+
"The OpenGL renderer cannot have a frame rate higher than 1000.\n" +
825+
"Your sketch will run at 1000 frames per second.");
826+
fps = 1000;
820827
}
821828
if (animator != null) {
822829
animator.stop();
@@ -1220,7 +1227,7 @@ void set() {
12201227
}
12211228

12221229
static Map<Integer, CursorInfo> cursors = new HashMap<>();
1223-
static Map<Integer, String> cursorNames = new HashMap<Integer, String>();
1230+
static Map<Integer, String> cursorNames = new HashMap<>();
12241231
static {
12251232
cursorNames.put(PConstants.ARROW, "arrow");
12261233
cursorNames.put(PConstants.CROSS, "cross");

0 commit comments

Comments
 (0)