[osg-users] osg2.x and osgViewer

David Oyarzun doyarzun at vicomtech.org
Thu Jul 3 07:28:41 PDT 2008

Hi all,

    I have a problem with an ActiveX control using osg. I have it working well in osg 1.x but when I have migrated it to osg 2.x (changing the producer viewer to osgviewer), the OnPaint function of the control is never called and I can not update the osg graph. I think it is a problem with my configuration of the viewer. I have this in the main class of the control:
    osg::ref_ptr<osg::Referenced> windata = new osgViewer::GraphicsWindowWin32::WindowData(GetSafeHwnd());
    // Setup the traits parameters
    traits->x = RectDLG.left;
    traits->y = RectDLG.top;
    traits->width = RectDLG.right - RectDLG.left;
    traits->height = RectDLG.bottom - RectDLG.top;
    traits->windowDecoration = false;
    traits->doubleBuffer = true;
    traits->sharedContext = 0;
    traits->setInheritedWindowPixelFormat = true;
    traits->inheritedWindowData = windata;

    osg::GraphicsContext* gc = osg::GraphicsContext::createGraphicsContext(traits.get());
    osg::ref_ptr<osg::Camera> camera = new osg::Camera;
    camera->setViewport(new osg::Viewport(0,0, traits->width, traits->height));
    GLenum buffer = traits->doubleBuffer ? GL_BACK : GL_FRONT;


if I comment the "traits->inheritedWindowData = windata;" line, all works ok, it is updated an all the events occurs, but the osg frame appears as a separate window, however, if I use this line it appears integrated in the browser but onPaint function is never called. I would thank you if somebody can help me.

Best regards,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080703/90fa918d/attachment-0002.htm>

More information about the osg-users mailing list