Hi Martin,

I replied to your message earlier, but I thought I would post my experience 
here for the benefits of those reading this thread down the line:

What I did was create a WinForms Control that hosts the OSG window. Look for 
examples (theres a good one on CodeProject I think) of integrating WPF and 
OpenGL. OSG will be the same. This is necessary because WPF uses HWNDs only for 
the top-level window - everything below is DirectX. But a WinForms control has 
an HWND, and WPF has an interoperability feature where it can host WinForms 
controls. 

There are limitations however - principally that transparent WPF popup windows 
(used for messages, menus, etc) do not show up properly over the OSG window 
under XP on most NVIDIA graphics cards (non-Quadro cards), according to NVIDIA. 
One possible workaround would be to have OSG render to a texture and then blit 
that to a WPF canvas. I have been intending to do this - but have not gotten 
around to it yet.  Currently I just structured my menus to avoid the overlap.

I should also mention that it is useful to crank up the OSG render loop during 
the initialization of the control - not at construction, IIRC.

There are a few other hurdles, like having to use the dispatcher to update WPF 
UI widgets, when the update originates from OSG - but these type of threading 
issues are to be expected in this type of app anyway. A lot of my daily pain 
comes from having to drill a piece of information down through several layers 
of code (abstraction layers for threading and for the managed/native 
transition) to get from the UI to the OSG render loop, which is again, to be 
expected. I have found a couple of issues with events, such as WPF not passing 
drag events (that originated from outside the app) down to OSG - which I dealt 
with by handling the events at the WinForms level, and then drilling down the 
mouse drag info to my OSG render loop.

Best of luck,
Brian

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=15651#15651





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to