Thanks Robert.   I'll give a go and see what damage I can do.
 
Mike
 

________________________________

From: [EMAIL PROTECTED] on behalf of Robert Osfield
Sent: Tue 5/1/2007 1:20 PM
To: osg users
Subject: Re: [osg-users] CMake and osgViewer::GrapicsWindowWin32


Hi Michael,

You should just be able to use #include <osgViewer/api/GraphicsWindowWin32> in 
your .cpp and then create the graphics context from this.  You should need to 
copy either GraphicsWindowWin32 or GraphicsWindowWin32.cpp .

You should also be able to use the general purpose 
GraphicsContext::createGraphicsContext(Traits*) method for creating the 
graphics context, rather than using new GraphicsWindowWin32(Traits*), this will 
make you code a smidgen more portable. 

The dynamic_cast<GaphicsContext*> is also not needed as GraphicsWindow is 
subclassed from osg::GraphicsContext so C++ itself can automatically downcast.

Robert.



On 5/1/07, Hartman, Michael W. (MSFC-NNM06AA05Z)[PEOPLETEC] <[EMAIL PROTECTED]> 
wrote: 

        Robert,
        
        Thanks for the info.   Looking at the code I don't understand how to 
set the handle for which window to have osg render to.   I have an application 
that has an existing control that I want OSG to render into.   I get the handle 
of that control and then how can I use that to tell OSG where to render. 
        
        With GraphicsWindowWin32 I can use the following code to do what I need 
but I don't see how to do it with GraphicsWindow only.
        
        osg::ref_ptr<osg::GraphicsContext::Traits> traits = new 
osg::GraphicsContext::Traits; 
        
        osg::ref_ptr<osg::Referenced> windata = new 
osgViewer::GraphicsWindowWin32::WindowData(m_hWnd);  //m_hWnd Handle to windows 
control for OSG to render to.
        
        
        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; 
        
        
        traits->inheritedWindowData = windata;
        
        osg::ref_ptr<osgViewer::GraphicsWindowWin32> gw = new 
osgViewer::GraphicsWindowWin32(traits.get());
        
        osg::ref_ptr<osg::Camera> camera = new osg::Camera; 
        
        
camera->setGraphicsContext(dynamic_cast<osg::GraphicsContext*>(gw.get()));
        
        
        
        At this point,  would you see any harm in specifically including 
GraphicsWindowWin32 (header and cpp) in my project so that I have access to 
them? 
        
        
        Thanks,
        Mike
        
        
        
        
        ________________________________
        
        From: [EMAIL PROTECTED] on behalf of Robert Osfield
        Sent: Tue 5/1/2007 11:29 AM 
        To: osg users
        Subject: Re: [osg-users] CMake and osgViewer::GrapicsWindowWin32
        
        
        Hi Mike,
        
        Current the subclasses from GraphicsWindow found in 
include/osgViewer/api/* like GraphicsWindowWin32 aren't yet included publically 
listed headers.  This does need to change, so we'll need to evolve the 
src/osgViewer/CMakeLists.txt to support the include/osgVIewer/api/* 
directories/files that are approrpriate for that platform. 
        
        However, even with out this GraphicsWindowWin32 being included things 
should still compile and run, as GraphicsWindowWin32 will work behinds the 
scenes as a default implementation of GraphicsWindow for Windows.
        
        Robert.
        
        
        On 5/1/07, Hartman, Michael W. (MSFC-NNM06AA05Z)[PEOPLETEC] <[EMAIL 
PROTECTED] > wrote:
        
                All,
        
                   Not sure if this is intentional, oversight, or my 
misunderstanding.  I do a full build with CMake (Visual Studio 8) and 
everything builds fine but when I go to use osgViewer in my existing MSFC 
application I don't have GraphicsWindowWin32 in the CMake output directory for 
"openscenegraph/include/osgViewer" and when I check out the lib that is 
produced there is no GraphicsWindowWin32 functions in the lib.   When I look 
over the files that are compiled I do see that GraphicsWindowWin32 is compiled 
but it does not seem to make it into the library. 
        
                Am I missing a define so that GraphicsWindowWin32 is included 
in the distribution or is there something else?
        
                Thanks for any help.
        
                Platform:  Windows XP
                Compiler: Visual Studio 8 
        
                Thanks
                Mike Hartman
        
        
                _______________________________________________
                osg-users mailing list
                [email protected] 
                http://openscenegraph.net/mailman/listinfo/osg-users
                http://www.openscenegraph.org/ 
        
        
        
        
        
        _______________________________________________
        osg-users mailing list
        [email protected]
        http://openscenegraph.net/mailman/listinfo/osg-users
        http://www.openscenegraph.org/
        
        


<<winmail.dat>>

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to