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
GLFW geometry constraints #7700
base: master
Are you sure you want to change the base?
GLFW geometry constraints #7700
Conversation
update to remove the GLUT attempt (trickier because glut seems more or less static-based, and about to be removed anyway) |
has been extensively used on macOS and no side-effects to report. |
@artificiel can you test what happens toggling fullscreen when the aspect ratio constraints don't match the fullscreen ratio? |
virtual void setWindowShape(int w, int h){} | ||
std::optional<glm::vec2> minimumWindowSize; | ||
std::optional<glm::vec2> maximumWindowSize; | ||
std::optional<glm::vec2> windowAspectRatio; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we make these protected ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
certainly! however in relation to the GLUT implementation (which is currently commented out) if the only window typer supporting these limits is GLFW, they could also be moved into private ofAppGLFWWindow?
(at the same time perhaps confirm it is not a priority to support GLUT? (who's callbacks are statics; makes things a bit different)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah - we should do a PR to remove all references to GLUT at this point.
🙂
OK well this sent me in a bit of rabbit hole.... (macOS). ofToggleFullscreen() does not behave like the green fullscreen button in the OS window.
i am not in a familiar territory but a bit of googling reveals the way to fullscreen GLFW is to set/unset windows with as a test, changing the whole Incidentally — this is not scientific, but an impression — I've been working on a program that traces slow curvy lines at 60fps (very low cpu, under 10% for the OF process), on macOS M1. when working in "OF Fullscreen", I sometimes feel a little hick-up here and there — but it's subtle, not a raw framerate issue, more like an interruption here and there (difficult to benchmark). Intuitively I made the window "OS" fullscreen (ctrl-cmd-F) and the drawing did not seem to glitch as much. so now googling led me to macOS game mode https://eclecticlight.co/2023/10/18/how-game-mode-manages-cpu-and-gpu/ — granted this is pretty recent stuff, but it made me wonder. after adding the entry to the plist I was granted this dialog: pardon the French but you get the keywords: activated, priority, performance — sounds like good things. the link above provides CPU and GPU analysis. all interesting, but it's becoming an involved side-quest. to come back to this PR: as window contraints mostly make sense only in window mode, perhaps the way to cover it is
on the fullscreen side OF should provide at least a way to programmatically trigger macOS fullscreen, which |
i am now thinking the GLFW constraints might be ignored and simply handle the constraints internally in setWindowShape and resize_cb. Maybe some funny things will happen if pulling at the extremes (like a 1-pixel fight) but it simplifies dealing with the somewhat hard-to-follow "fullscreen state"... so basically only point 3 above. |
…ficiel/openFrameworks into window-geometry-constraints
add support for windows contraints (size and/or aspect ratio). tested in GLFW;
GLUT should work (they say to enforce yourself it in the resize callback).not sure how to handle/test other windows? (e.g. in EAGL ofLogWarning() to mention the operation is unimplemented?)
behaves like this with some "adaptive" content: minimum size only:
aspect ratio locked to 4:3 + minimum size: