Sherman,

With C++/CLI and its IJW ("It Just Works") interop, you don't run into the
issues you do with C#. C++/CLI is a superset of C++. That said there are a
couple things to keep in mind:

First, C++/CLI lets you mix managed and unmanaged C++, and there are some
restrictions in how you are allowed to do that. These usually come down to
memory management. For example, you cannot have an osg::ref_ptr<Object> as a
member of a managed C++ class IIRC. Likewise an unmanaged class can't have a
managed reference as a member (although there are ways around this). In any
case these are minor issues and easy to work around.

Second, and this is a little nebulous, there is something "going on" when
OSG code calls back into user code in a mixed assembly. I mean something
like a cull callback, or an OSG class override. Something that causes the
flow of execution to go into the OSG libs and then come back into the mixed
assembly. I've seen ever-so-slight performance drops when this happens. To
test this, I subclassed DatabasePager, override NO methods, installed an
instance of my new object, and got a slightly lower frame rate!

Finally is the issue of continuous rendering. Some OSG mechanisms (like
paging) rely on a continuously running frame loop. .NET's synchronous timers
can't really give you deterministic frame timing. So if you are writing a
simulator and need exact frame timing, you will probably need to run the OSG
renderer in another thread and marshal your controller calls across the
thread boundary. It's a hassle but .NET's delegate/invoke construct come in
very handy for doing this.

HTH. -gw

On Feb 17, 2008 12:55 PM, sherman wilcox <[EMAIL PROTECTED]> wrote:

> Glenn - ever run into any issues where you found portions of OSG not
> to "work" with C++/CLI? I believe the OSG/C# folks run into this a
> lot. Any odd difficulties or does everything just work?
>
> Follow-up question - have you written any OSG/C++/CLI WPF apps?
> Winforms? How well does all this stuff "play" together?
>
> On Feb 16, 2008 10:16 PM, Glenn Waldron <[EMAIL PROTECTED]> wrote:
> > Sherman,
> > I'll vouch for it ... I've written dozens of apps using C++/CLI and OSG
> and
> > it works great. It is very convenient to be able to mix managed and
> > unmanaged code virtually at will (there are a few restrictions) as the
> > interop is handled transparently by the CLR. Plus with .NET 2.0, it's
> simple
> > to write an OSG .NET Control in a C++/CLI assembly, and then use it in
> all
> > your C# UI code.
> > -gw
> >
> > --
> > Glenn Waldron : Pelican Mapping : http://pelicanmapping.com :
> 703-652-4791
> >
> >
> >
> > On Feb 16, 2008 10:10 PM, sherman wilcox <[EMAIL PROTECTED]>
> wrote:
> > > Ok - so it sounds as if using C# with OSG is bad idea. Sounds possible
> > > - just painful. On the plus side I hear (on occasion) good things said
> > > about C++/CLI. Can anyone else comment on their experience using OSG
> > > and C++/CLI?
> > >
> > >
> > >
> > >
> > > On Feb 14, 2008 10:48 AM, hesicong2006 <[EMAIL PROTECTED]> wrote:
> > > > Hi,
> > > > You should try OSG.NET project, but the project does not contains
> every
> > > > feature OSG could provide. A much better solution will be use of
> > > > C++/CLI, this language can create mix native C++ and managed code.
> The
> > > > main C# UI design benefit is also contained in C++/CLI. I have use
> > > > C++/CLI to integrate OSG and .NET, very well, you should try it. But
> the
> > > > plain will be the much lower compile speed due to lots of inline
> code of
> > > > OSG.
> > > >
> > > >
> > > > sherman wilcox wrote:
> > > > > I've read a few posts and I'm a bit fuzzy on the subject. I have
> an
> > > > > OSG app wrapped up in a C++ library. Now I need a UI. I can attach
> > > > > this and drive this libarary from a console app, MFC GUI, or even
> the
> > > > > standard Windows API, etc. - All in C++. However, I'm considering
> > > > > using C#. I've heard lots of good things about C# from a UI
> > > > > development perspective. From an OSG/C# point of view - there
> seems to
> > > > > be lots of pain.
> > > > >
> > > > > I'm not a C# developer - it's all Greek to me - so what I'm
> imagining
> > > > > may not be practical in reality hence this post. Is it possible to
> > > > > link in my OSG app wrapped up in a C++ blanket and use my own API
> from
> > > > > with a C# GUI? Is it painful? What would I lose by going this
> route?
> > > > > Is possible that at some point I won't be able to take advantage
> of
> > > > > some latest OSG feature due to some unforeseen incapability? My
> > > > > current UIs (I'm thinking of one MFC UI in particular) don't
> really
> > > > > interact with the OSG - that's all handled by my own C++ API. I'm
> just
> > > > > not sure how well all this would glue together using C#.
> > > > >
> > > > > Can some of the veterans comment?
> > > > >
> > > > >
> > > >
> > > >
> > > > _______________________________________________
> > > > 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
> > >
> >
> >
> >
> > _______________________________________________
> > 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
>



-- 
Glenn Waldron : Pelican Mapping : http://pelicanmapping.com : 703-652-4791
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to