Hi Marco,

I doubt what you are seeing is a bug in the OSG, rather a
manifestation of trying to do something is crazy way.  It seems you
are trying to hide a window by putting it off screen, but even more
odd you are destroying the graphics window and then recreating it off
screen, but would you need to create something you are not going to
see.  It's perplexing trying to work out what you really intend.

Might I suggest you explain in simple terms how you want your
application to behave and let others in the community suggest how best
to achieve this.

Robert.

On 27 May 2014 08:29, Marco Kliko <marco_kl...@hotmail.com> wrote:
> Hi everybody,
>
> I have found a possible bug in OSG. But maybe I am using OSG wrong.
> Hopefully someone can help me finding a solution.
>
> Here's the case:
> I want to use OSG for 3D rendering a model that I use in my own software 
> programm. To "embed" the OSG window in my program, I want to put it on top of 
> the page that normally shows the 3D-model.
> When I'm not displaying the page, I want to stop/pause  the rendering task 
> and put the window outside my screen (pos -1000, -1000 or something).
>
> At first, I tried it with
>
> Code:
> Viewer->stopThreading();
> Viewer->setUpViewInWindow(-1000, -1000, 640, 480);
> Viewer->startThreading();
>
>
> to remove the window and
>
> Code:
> Viewer->stopThreading();
> Viewer->setUpViewInWindow(x,y,width,height);
> Viewer->startThreading();
>
>
> to show the window again.
>
> Somewhere else in my code I have a if-condition that checks if I need to 
> render new pages.
>
> Code:
>
> if(page_visible)
> {
>     viewer->frame();
> }
>
>
>
>
> This is working fine and actually was really suprised how quick it was. 
> Kudo's to OSG!
>
> But now I want the same window, but without the windows decoration. Because 
> when I use it on top of my own software, I want it it to have it look it's 
> embedded in the programm. This means that it has no windows-boarders around 
> the osg-window. Also the minimize, restore and close buttons on the right top 
> corner are gone too.
>
> I found out this could be done with traits. But when I replace 
> setUpViewInWindow with traits I doesn't work like I expected.
> At first, the viewer comes, but without keyboard input. (This used to work 
> with setUpViewInWindow).
> But then when I call makeViewerInvisible, the window leaves the screen-area. 
> So that is fine.
> Then I call makeViewerVisible, and then the window doesn't show up.
> When I add a breakpoint at the start of makeViewerInvisible, the window 
> appear in a flash, to disappear again.
>
> I hope you guys can reproduce this bug. (If it is a bug of course...)
>
> Here's the code:
>
>
> Code:
>
>
> //at init
> //please not, this is now a standalone project to test if it works, so at 
> init, I make the viewer visible.
>
> void interfaceOSG::init_viewer(osgViewer::Viewer* Viewer, int x, int y, int 
> width, int height)
> {
>
>         scene = osgDB::readNodeFile("d:/OpenSceneGraph-Data/cessna.osg");
>         Viewer->setCameraManipulator(new osgGA::TrackballManipulator());
>
>         Viewer->setSceneData(scene);
>         /*Viewer->setUpViewInWindow(x, y, width, height);*/
>
>         traits->x = x; //in screen space
>         traits->y = y; //in screen space
>         traits->width = width;
>         traits->height = height;
>         traits_das->windowDecoration = false; // Removes the window's border
>
>         osg::ref_ptr<osg::GraphicsContext> graphicsContext = 
> osg::GraphicsContext::createGraphicsContext(traits_das.get());
>
>         viewer->getCamera()->setGraphicsContext(graphicsContext);
>         viewer->getCamera()->setViewport(new osg::Viewport(0, 0, 640, 480));
>         Viewer->addEventHandler(new KeyboardEventHandler());
> }
>
> void interfaceOSG::makeViewerVisible(osgViewer::Viewer* Viewer, int x, int y, 
> int width, int height)
> {
>         Viewer->stopThreading();
>         traits->x = x;
>         traits->y = y;
>         traits->width = width;
>         traits->height = height;
>         traits->windowDecoration = false; // Removes the window's border
>
>         osg::ref_ptr<osg::GraphicsContext> graphicsContext = 
> osg::GraphicsContext::createGraphicsContext(traits_das.get());
>
>         viewer->getCamera()->setGraphicsContext(graphicsContext);
>         viewer->getCamera()->setViewport(new osg::Viewport(0, 0, 640, 480));
>         Viewer->startThreading();
> }
>
> void interfaceOSG::makeViewerInvisible(osgViewer::Viewer* Viewer)
> {
>         Viewer->stopThreading();
>         //Viewer->setUpViewInWindow(-1000, -1000, 640, 480);
>         traits->x = -1000;
>         traits->y = -1000;
>         traits->width = 640;
>         traits->height = 480;
>         traits->windowDecoration = false; // Removes the window's border
>
>         osg::ref_ptr<osg::GraphicsContext> graphicsContext = 
> osg::GraphicsContext::createGraphicsContext(traits_das.get());
>
>         viewer->getCamera()->setGraphicsContext(graphicsContext);
>         viewer->getCamera()->setViewport(new osg::Viewport(0, 0, 640, 480));
>
>         Viewer->startThreading();
> }
>
>
>
>
>
> If I wasn't clear enought about something, please do not hesitate to ask me 
> more info. I'll gladly try to explain it further.  :)
>
> I hope you guys can help me. If I can't make this work, OSG will sadly be a 
> big showstopper for my program... :|
>
> Thank you!
>
> Cheers,
> Marco
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=59570#59570
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to