Hide/disable viewer window and avoid "graphics computation". #1234
Unanswered
DarioMaggiari
asked this question in
Q&A
Replies: 2 comments 3 replies
-
Have a look at the implementation of render on demand code in Viewer::run(), essentially the update and event traversals are done but nothing is rendered unless a dirty state is matched. https://github.com/openscenegraph/OpenSceneGraph/blob/master/src/osgViewer/ViewerBase.cpp#L685 You needn't use Viewer::run() yourself, you could implement something similar in your own frameloop. |
Beta Was this translation helpful? Give feedback.
3 replies
-
Seems to me like you have the not rendering part working, and now you want
to not show the window. Osg doesn't provide this option, so you need to go
to the underlying windowing system: for windows the code looks like:
#include <osgViewer/api/Win32/GraphicsWindowWin32>
void
viewer::setWindowVisibility(bool on)
{
if (_graphicsWindow.valid()) {
osgViewer::GraphicsWindowWin32* win =
dynamic_cast<osgViewer::GraphicsWindowWin32*>(_graphicsWindow.get());
HWND hwin = win->getHWND();
if (hwin) {
ShowWindow(hwin, on ? SW_SHOW : SW_HIDE);
}
If you would prefer to NEVER show a window, you can change bool
GraphicsWindowWin32::realizeImplementation() (in
OpenScenGraph\src\osgViewer\GraphicsWindowWin32.cpp)
to call SetWindowPos with the "SWP_HIDEWINDOW" instead of the
"SWP_SHOWWINDOW" flag.
Regards, laurens.
…On Fri, Jun 9, 2023 at 4:31 PM DarioMaggiari ***@***.***> wrote:
Basically now there is not broken parts (in effect I see the realize() is
called by in some point in the code). I only need to do not show the
graphics context (now it's a black screen but is ok because there is no
rendering traversal as I want) and then I'm done :D
—
Reply to this email directly, view it on GitHub
<#1234 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEXFTWR6MBVNRWDRTXFYILTXKMXVXANCNFSM6AAAAAAZATC3MU>
.
You are receiving this because you are subscribed to this thread.Message
ID: <openscenegraph/OpenSceneGraph/repo-discussions/1234/comments/6133724@
github.com>
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I'm using OSG 3.4.0.
I need to hide/disable the viewer window, mantaining the underlay computation unaltered (expecially for BB and collisions detection).
Basically, I need to keep the scenegraph update synchronized with my data (via OSG callback mechanism already implemented) but I have to skip the rendering on viewer.
Obviously, I think the first workaround should be to setup a traits with width and height at 0px, but I need the most correct and performance solution to keep away any unwanted overhead (because the "graphics part" is really unuseful in this situation).
Can you suggest me a way?
Many thanks,
Bye
Beta Was this translation helpful? Give feedback.
All reactions