Hi Nick,
>this belongs in a loop. Here is the lib::postMessageWith this I assume you 
>mean that we have to embed/hook the first code poriton into WndProc loop, 
>right ??Because all this are runing under the OnButtonClick for me, I'll chage 
>it hooked into main window WndProc but for time being I use it for testing 
>purposes.
I tried to simplfy the code as below but it raises segmentation fault at the 
last line fWndProc.Am I really messing something with pointers there ? 
osgViewer::CompositeViewer::Windows wins;g_viewer->getWindows(wins);
        MSG msg;        if (::PeekMessage(&msg,NULL,0,0,PM_NOREMOVE))        {  
      ::GetMessage(&msg, NULL, 0, 0);            if (wins.size())            {  
              osgViewer::GraphicsHandleWin32 *hdl = 
dynamic_cast<osgViewer::GraphicsHandleWin32*>(wins.at(0));                
if(hdl)                {                    MSG message =msg;                   
 WNDPROC fWndProc = (WNDPROC)::GetWindowLongPtr(hdl->getHWND(), GWLP_WNDPROC);  
                  fWndProc(hdl->getHWND(), message.message, message.wParam, 
message.lParam);                }            }
        }
Regards,

Date: Mon, 11 Aug 2014 11:37:36 +0200
From: trajce.nikolov.n...@gmail.com
To: osg-users@lists.openscenegraph.org
Subject: Re: [osg-users] Integrating OSG in C::B wxWidgets

Hi Sonya,
although on Windows is sufficient to set the window handle in the traits, based 
on your app you might really want to pass the messages explicitly. Here is a 
snippet of an example:

                        MSG msg;                        if 
(::PeekMessage(&msg,NULL,0,0,PM_NOREMOVE))                   {
                                ::GetMessage(&msg, NULL, 0, 0);                 
        lib->postMessage((void*)&msg);                  }

this belongs in a loop. Here is the lib::postMessage
osgViewer::CompositeViewer::Windows wins;               
_viewer->getWindows(wins);
                #ifdef WIN32            if (wins.size())                {
                        osgViewer::GraphicsHandleWin32 *hdl = 
dynamic_cast<osgViewer::GraphicsHandleWin32*>(wins.at(0));                      
  if(hdl)
                        {                               MSG* message = 
(MSG*)msg;                               WNDPROC fWndProc = 
(WNDPROC)::GetWindowLongPtr(hdl->getHWND(), GWLP_WNDPROC);
                                fWndProc(hdl->getHWND(), message->message, 
message->wParam, message->lParam);                   }               }
#endif
Cheers,Nick

On Mon, Aug 11, 2014 at 10:45 AM, Sonya Blade <sonyablade2...@hotmail.com> 
wrote:




Dear All,
When we try to integrate the OSG rendering context into another Win32/64 window 
via window handle 
do we need to hook also the message handling mechanism ? If so can you give me 
an example for that ?
Regards,



From: sonyablade2...@hotmail.com
To: osg-users@lists.openscenegraph.org

Date: Sat, 9 Aug 2014 11:32:27 +0100
Subject: [osg-users] Integrating OSG in C::B wxWidgets




Dear All,
I'm trying to integrate the OSG view into wxWidgets actually wxFrame object in 
C::B IDE, I configure 
the Window handles to match with wxFrame and OSG graphic context but I get only 
a blue screen without cessna loaded. 

I place the code which deals with window handle equalization in a kinda unusual 
way, under the button click, after clicking the button blue screen shows up but 
cessna is not loading, I mean physically the cessna is not loaded,
I can not spot/testify exactly whether the malfuncitoning is due to the unusual 
way of placing the window handle dealing code under the button click or 
something else ? 

So basically is there any workaround to load the object  ?
void wid_testFrame::OnButton1Click(wxCommandEvent& event)
    osg::ref_ptr<osg::Referenced> windata = new 
osgViewer::GraphicsWindowWin32::WindowData( HWND( wxFrame::GetHandle() ) );

    osg::ref_ptr<osg::GraphicsContext::Traits> traits = new 
osg::GraphicsContext::Traits;
    traits->x = 0;
    traits->y = 0;    traits->width = 800;    traits->height = 600;    
traits->windowDecoration = false;
    traits->doubleBuffer = true;    traits->inheritedWindowData = windata;
    osg::ref_ptr<osg::GraphicsContext> gc = 
osg::GraphicsContext::createGraphicsContext( traits.get() );

...........    osg::ref_ptr<osg::Node> load_model = 
osgDB::readNodeFile("cessna.osg");

if (!load_model )    {       ............     /////////////////ALWAYS FALSE     
        }
............   viewer.run();                                      

_______________________________________________
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




-- 
trajce nikolov nick



_______________________________________________
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