Hi hesicong(?),

 

Somehow I missed your email until just now, but thanks for your
feedback!

 

The Osg.GraphicsContext.Traits issue you've run into is a known
deficiency.  Currently public member variables are not wrapped other
than via OSG-provided getters/setters.  Support is available for this in
osgIntrospection, it just hasn't been implemented yet in the wrappers.
Unfortunately there's no good way to work around this problem at the
user level.

 

I did add one parameter versions of the osgDB::read* functions.  That's
now checked in to SVN.

 

-Mike

 

________________________________

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of hesicong2006
Sent: Tuesday, June 26, 2007 3:58 AM
To: osg users
Subject: Re: [osg-users] Announcing osgDotNet: C#/.NET wrappersfor
OpenSceneGraph

 

Mike Wittman wrote: 

Hi everyone,

 

I'm pleased to announce the release of osgDotNet, a binding of the
OpenSceneGraph libraries to the .NET/CLR platform.  osgDotNet allows
OpenSceneGraph to be used and extended from C# with an API that closely
mirrors the C++ interface.

 

The initial version, osgDotNet 0.8, supports OpenSceneGraph 2.0 on .NET
2.0 and later.  This release should be considered beta -- it's mature
enough to be usable although there are still some rough edges.  I'd
invite anyone who may be interested in using OpenSceneGraph from C# to
jump in and give it a try.

 

Wrapper assembly binaries for x86 and x64, the generator that created
them, and information on getting started with both are on the osgDotNet
Trac wiki:

            http://www.openscenegraph.com/projects/osgDotNet

                                                                 

Thanks go to my employer, Seismic Micro-Technology, Inc., for releasing
the osgDotNet wrapper generator under the GPL, and Robert Osfield and
Jose Luis Hidalgo for hosting the project on the OpenSceneGraph server.

 

 

Mike Wittman

[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 

___________________________________________________

Seismic Micro-Technology, Inc.

8584 Katy Freeway, Suite 400 / Houston, Texas 77024

Tel.  +1 (713) 464-6188

Fax. +1 (713) 464-6440

Web:  www.seismicmicro.com
<blocked::blocked::http://www.seismicmicro.com> 

___________________________________________________

Seismic through Simulation with KINGDOM, (RC)2, and SURE! - CONTACT US
TODAY for more information.

 

 

I have tested it. I have built the generator, and got the final
solution. Then I built the final code, all seems to be OK.
Then I tested the the program in the wiki, that's good, a full screen
colorful square is displayed.
Now I try to do further work. I want to render this to an C# control. I
have managed to do this by using C++/CLI:

        void SetRenderSurface(Control^ control)        {

            HWND hwnd=(HWND)control->Handle.ToInt32();
            osg::ref_ptr<osg::Referenced> windata = new
osgViewer::GraphicsWindowWin32::WindowData(hwnd);
            osg::ref_ptr<osg::GraphicsContext::Traits> traits=new
osg::GraphicsContext::Traits;

            traits->x = 0;
            traits->y = 0;
            traits->width = control->Right-control->Left;
            traits->height = control->Bottom-control->Top;
            traits->windowDecoration = false;
            traits->doubleBuffer = true;
            traits->sharedContext = 0;
            traits->inheritedWindowData = windata;

            // We must set the pixelformat before we can create the OSG
Rendering Surface
            //
            PIXELFORMATDESCRIPTOR pixelFormat =
            {
                sizeof(PIXELFORMATDESCRIPTOR),
                1,
                PFD_DRAW_TO_WINDOW |
PFD_SUPPORT_OPENGL|PFD_DOUBLEBUFFER,
                PFD_TYPE_RGBA,
                24,
                0, 0, 0, 0, 0, 0, 0, 0,
                0, 0, 0, 0, 0,
                24,
                0,
                0,
                PFD_MAIN_PLANE,
                0,
                0, 0, 0
            };

            HDC hdc = ::GetDC(hwnd);
            if (hdc==0)
            {
                ::DestroyWindow(hwnd);
                throw gcnew Exceptions::InitOpenGLFailedExpection();
            }

            int pixelFormatIndex = ::ChoosePixelFormat(hdc,
&pixelFormat);
            if (pixelFormatIndex==0)
            {
                ::ReleaseDC(hwnd, hdc);
                ::DestroyWindow(hwnd);
                throw gcnew Exceptions::InitOpenGLFailedExpection();
            }

            if (!::SetPixelFormat(hdc, pixelFormatIndex, &pixelFormat))
            {
                ::ReleaseDC(hwnd, hdc);
                ::DestroyWindow(hwnd);
                throw gcnew Exceptions::InitOpenGLFailedExpection();
            }
            gc=GraphicsContext:o:createGraphicsContext(traits.get());
        }

But I can find Osg.GraphicsContext.Traits but I can't find any property
or public various which I can set the x,y,width,height and etc like C++.
I looked at the assembly, Traits have no other public member. And it
inherited only from Reference, but the source code of C++ is inherited
from Reference and ScreenIdentifier. 

These is also another problem. The OsgDB.global.readNodeFile do not have
one parameter version like C++: 
inline osg::Object* readObjectFile(const std::string& filename)
{
    return readObjectFile(filename,Registry::instance()->getOptions());
}

Hope you can correct these problems and make .NET version OpenSceneGraph
more powerful! 
I'll try your lastest SVN version whenever you fixed these problems!
Thanks!

_______________________________________________
osg-users mailing list
osg-users@openscenegraph.net
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to