Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

frameRate() below 1 fails for P2D & P3D #4716

Closed
GoToLoop opened this issue Oct 26, 2016 · 7 comments
Closed

frameRate() below 1 fails for P2D & P3D #4716

GoToLoop opened this issue Oct 26, 2016 · 7 comments
Labels

Comments

@GoToLoop
Copy link

void setup() {
  //size(800, 600, JAVA2D); // JAVA2D works w/ below 0 frameRate().
  //size(800, 600, FX2D); // FX2D works w/ below 0 frameRate().
  size(800, 600, P2D); // P2D doesn't work w/ below 0 frameRate()!!!
  //size(800, 600, P3D); // P3D doesn't work w/ below 0 frameRate()!!!

  frameRate(.5); // below zero argument.
}

void draw() {
  background((color) random(#000000));
}
@GoToLoop GoToLoop changed the title frameRate() below 0 fails for P2D & P3D renderers! frameRate() below 0 fails for P2D & P3D renderers under P3! Oct 26, 2016
@GoToLoop GoToLoop changed the title frameRate() below 0 fails for P2D & P3D renderers under P3! frameRate() below 0 fails for P2D & P3D under P3! Oct 26, 2016
@benfry benfry added the opengl label Oct 29, 2016
@benfry benfry changed the title frameRate() below 0 fails for P2D & P3D under P3! frameRate() below 1 fails for P2D & P3D Oct 29, 2016
@codeanticode
Copy link
Member

This is due to a limitation in JOGL's FPSAnimator, which we are currently using to drive the rendering loop in the OpenGL renderer and only accepts an integer fps. We would need to file an upstream issue with JOGL or consider other alternatives for controlling the framerate.

@GoToLoop
Copy link
Author

GoToLoop commented Oct 30, 2016

Oh, I got it! But I thought FPS was based on some delta calculated within handleDraw() or something.

@GoToLoop
Copy link
Author

Dunno why "under P3" was removed from the title, since it implies it WORKS under P2!
On 2nd thought, why would it work for all renderers under P2 but fail under P3?
Clearly the approach used under P2 was compatible fro all renderers, no matter whether they were OpenGL-based or not.

@benfry
Copy link
Contributor

benfry commented Oct 30, 2016

@codeanticode Can you just have it return an error or warning in that case? Probably capping the minimum rate at 1 and using showWarning() when it's lower would be the right approach. (Rather than halting the sketch with an error in that case.)

@codeanticode
Copy link
Member

Ok, done in 2a77ed8

@benfry
Copy link
Contributor

benfry commented Nov 4, 2016

Cool, thanks.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants