-
Notifications
You must be signed in to change notification settings - Fork 604
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
Fix screen for applications that want to manage their own glfw and not rely on nanogui #91
Conversation
…ns that want to manage their own glfw context and code
… your own glfw and render loop Also fix the cmake comment for GLAD
…ounds The alignment and tooltip width was off for when a tooltip text was smaller than the hard-coded tooltip box of 150px. Account for this when drawing the tooltip and tooltip bounds box
…ce we dont always want to control GLFW functionality If we are not the owner, then don't automatically hide the glfw window when we make the root screen not visible, we might simply not want to show the GUI, but carry on showing the glfw window.
@@ -192,6 +192,7 @@ class NANOGUI_EXPORT Screen : public Widget { | |||
std::string mCaption; | |||
bool mShutdownGLFWOnDestruct; | |||
bool mFullscreen; | |||
bool mOwningGLFWContext; |
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.
Indentation issue (are you using tabs? NanoGUI uses only spaces.)
glfwShowWindow(mGLFWWindow); | ||
else | ||
glfwHideWindow(mGLFWWindow); | ||
if (mOwningGLFWContext) { |
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.
Why disable setVisible() for non-owned GLFW context? I think it would be quite reasonable to leave this on.
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.
If I am managing my own GLFW and windowing code, and just using a pointer to a 'screen' object for my GUI, having the whole window hidden just because I call: screen->setVisible(false) is misleading, what if I just want to hide the GUI alone, but keep my true window visible?
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.
Well, screen
is a wrapper around the GLFW window, so setVisible()
should be forwarded to GLFW. Whether the Screen also owns the GLFW window and is responsible for construction/deconstruction should not change the behavior of this function. Hiding the individual windows can be accomplished with their respective setVisible() functions.
I added a few more comments -- after that, it looks good to me. |
(Please squash everything into one commit when you're done.) |
merged, thanks! |
Also include a new example, example3.cpp that demonstrates a way to create your own windows management code with glfw but still create GUI objects with nanogui.