dwmkerr / sharpgl

Use OpenGL in .NET applications. SharpGL wraps all modern OpenGL features and offers a powerful scene graph to aid development.
MIT License
770 stars 300 forks source link

build object with the SceneControl #189

Open pas059 opened 4 years ago

pas059 commented 4 years ago

Hello,

In order to translate the 3D rendering part of code of a WindowsFrom application (.Net/C#), i'm looking for a 3D sdk with a scenegraph. SharGL seems to me to contain this feature with its SceneControl. Starting from the sample SceneSample, i just tried to create an object : a cylinder + its top disk. To do this, i do:

            Cylinder cylindre = new Cylinder() { Name = "Cylindre1" };
            cylindre.BaseRadius = cylindre.TopRadius = 2;
            cylindre.Height = 2;
            Disk topDisk = new Disk() { Name = "TopDisk" };
            topDisk.OuterRadius = 2;
            topDisk.InnerRadius = 1;
            topDisk.Transformation.TranslateZ = (float)cylindre.Height;
            cylindre.Children.Add( topDisk );

            cylindre.Transformation.TranslateZ = 4;
            sceneControl1.Scene.SceneContainer.AddChild( cylindre );

Unfortunately, this gives an 'System.AccessViolationException ' during execution. I assume i miss something, or mis understanding the usage.

Someone can help, or give a link to a sample with a basic object contruction?

regards Pascal