Hello!
I am creating an osg scene, which is rendered to a .NET picture box on a
windows forms scene.
Code:
void startInFormWinCpp(int wh){ //wh is a window handle
HWND hwnd = (HWND)wh;
baseViewer = new osgViewer::Viewer();
osg::ref_ptr<osg::GraphicsContext::Traits> traits = new
osg::GraphicsContext::Traits();
traits->inheritedWindowData = new osgViewer::GraphicsWindowWin32::WindowData(
hwnd );
traits->setInheritedWindowPixelFormat = true;
traits->supportsResize = true;
RECT rect;
::GetWindowRect( hwnd, &rect );
traits->x = 0;
traits->y = 0;
traits->width = rect.right - rect.left;
traits->height = rect.bottom - rect.top;
traits->windowDecoration = false;
traits->doubleBuffer = true;
traits->sharedContext = 0;
osg::ref_ptr<osg::GraphicsContext> graphicsContext =
osg::GraphicsContext::createGraphicsContext( traits.get() );
baseViewer->getCamera()->setGraphicsContext( graphicsContext.get() );
baseViewer->getCamera()->setViewport( new osg::Viewport( 0, 0, traits->width,
traits->height ) );
baseViewer->getCamera()->setProjectionMatrixAsPerspective(30.0f,
static_cast<double>(traits->width)/static_cast<double>(traits->height), 1.0f,
10000.0f);
baseViewer->setCameraManipulator(new osgGA::TrackballManipulator());
camera=baseViewer->getCamera();
camera->setClearColor(osg::Vec4(0.7f, 0.7f, 0.7f, 1.0f));
osg::ref_ptr<osg::Group> rootViewGroup= new osg::Group();
rootViewGroup->addChild(rootGroup);
baseViewer->setSceneData( rootViewGroup.get() );
_beginthread(renderStatic, 0, (void*)this);
}
I want to use some custom cursors depending from what am I doing. But on these
objects, there are no functions to set the cursor (only if I would get a
osgViewer::GraphicsWindowWin32). So I tried to change the cursor in .NET, this
works only sometimes (on mouseDown I change the cursor - this is OK, on mouse
up I change it again, but the default arrow is shown istead of my custom
cursor).
I also tried to set traits->useCursor = false; but then the cursor
disappeared (after mouseUp).
So the question is - how can I disable the overriding of the cursor in osg? OR
how can I use a custom cursor - in OSG, when I use a HWND from .NET to render
the scene? Has anyone experience with this?
Thank you for your answers!
Cheers,
Peter[/code]
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=51062#51062
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org