Hi Clement,

about your second screen: if you create your OpenGL context on the external screen - have you checked if this screen also has hardware acceleration? I remember having a smimilar behaviour with another toolkit. Black screen when creating the OGL context not on the primary screen with OGL hardware acceleration enabled...

Perhaps this is a hint...

Greets,

Patrik


On 31.01.2015 11:43, Robert Osfield wrote:
Hi Clement,

I'm afraid I can't help you, I not a windows expert and don't know MFC
at all, I'm not the author of the osgviewerMFC example.

The code snippets you have provide don't really give me any clues to
what might be amiss.

I don't have any means of recreating the problems you are seeing with
your application, or you hardware and data.

All I can say it general it is possible to changing window sizes, and it
is possible to create new windows without problems, others do and I've
done it lots myself but never with MFC.  I have no clue with it's a MFC
specific issue you are up against, or how you've gone around
implementing it.

Robert.

On 31 January 2015 at 03:12, <clement....@csiro.au
<mailto:clement....@csiro.au>> wrote:

    Hi Robert,

       This is the code for showing image in MFC window. (I followed the
    osgviewerMFC example).

    osg::ref_ptr<osg::GraphicsContext::Traits> traits = new
    osg::GraphicsContext::Traits;
    traits->x = 0;
    traits->y = 0;
    traits->windowDecoration = false;
    traits->doubleBuffer = true;
    traits->sharedContext = 0;
    traits->setInheritedWindowPixelFormat = true;
    traits->width = rect.right - rect.left;
    traits->height = rect.bottom - rect.top;
    traits->inheritedWindowData = new
    osgViewer::GraphicsWindowWin32::WindowData(m_hWnd);
    osg::ref_ptr<osg::GraphicsContext> gc =
    osg::GraphicsContext::createGraphicsContext(traits.get());
    osgCamera->setGraphicsContext(gc.get());

    It requires to set window handle (HWND) into Trait to show image
    into MFC window.  The window decoration is already set to false.  If
    I changed the size, the osgViewer is still inside the MFC window.  I
    would like to switch the osgviewer to display on external monitor
    (full screen) programmatically.  I tried many methods and seems I
    can do it with creating a new GraphicsContext and new Trait without
    assign any HWND and specify the screen number, such as...

    osg::GraphicsContext::WindowingSystemInterface* wsi =
    osg::GraphicsContext::getWindowingSystemInterface();
    osg::GraphicsContext::ScreenIdentifier si;
    si.readDISPLAY();
    traits->hostName = si.hostName;
    traits->displayNum = si.displayNum;
    traits->screenNum = si.screenNum;


    The method seems working fine, but the image is already blank at the
    first.  Once I changed DisplaySettings with grayscale and stereo
    mode, the image will come out properly.  I would like to know why
    replaced a new GraphicsContext with existing camera will cause the
    blank problem and why the image can show up again after changing
    some display settings.  Or I already did a wrong way to switch the
    current viewer to show on full screen.  Please advise.  Thanks.



    Regards,
    Clement




    ________________________________________
    发件人: osg-users [osg-users-boun...@lists.openscenegraph.org
    <mailto:osg-users-boun...@lists.openscenegraph.org>] 代表 Robert
    Osfield [robert.osfi...@gmail.com <mailto:robert.osfi...@gmail.com>]
    发送时间: 2015年1月31日 03:18
    收件人: OpenSceneGraph Users
    主题: Re: [osg-users] Blank screen

    Hi Clement,

    My guess is that way you hacking the screen size change by creating
    a new context is screwing up the way context ID's and OpenGL objects
    are managed.

    My recommendation would be to just switch off window decoration and
    change the window size of the context rather than creating a new one.

    Robert.

    On 30 January 2015 at 16:04,
    <clement....@csiro.au<mailto:clement....@csiro.au
    <mailto:clement....@csiro.au>>> wrote:
    Hi all,

       I am trying to output my volume image on full screen with MFC by
    changing GraphicsContext in camera.  First I get GraphicsContext
    from camera and then close it.  Then I created a new GraphicsContext
    with setting screen number and size of full screen and then set it
    to camera.  It works to show full screen and also restore back to
    mfc window, but the image cannot show probably.  There is no image
    on screen (volume data) and show the axes I drawn only.  If I
    changed the display setting to stereo (Anaglyphic) and set grayscale
    on and off.  Then the image will come out.  I am not sure how to fix
    it.  See if anyone can help me.  Thanks.


    Regards,
    Clement



    _______________________________________________
    osg-users mailing list
    osg-users@lists.openscenegraph.org
    
<mailto:osg-users@lists.openscenegraph.org><mailto:osg-users@lists.openscenegraph.org
    <mailto:osg-users@lists.openscenegraph.org>>
    http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

    _______________________________________________
    osg-users mailing list
    osg-users@lists.openscenegraph.org
    <mailto: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


_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to