コード例 #1
0
        /// <summary>
        /// Creates the scene.
        /// </summary>
        private void CreateScene()
        {
            //  Create OpenGL.
            gl.Create(RenderContextType.DIBSection, 800, 600, 32, null);

            //   Create the scene object.
            Scene = new Scene() { OpenGL = gl };

            //  Initialise the scene object.
            SharpGL.SceneGraph.Helpers.SceneHelper.InitialiseModelingScene(Scene);

            //  Create a sphere.
            SharpGL.SceneGraph.Quadrics.Sphere sphere = new SharpGL.SceneGraph.Quadrics.Sphere();

            //  Add it.
            Scene.SceneContainer.AddChild(sphere);

            //  Create the arcball camera.
            var camera = new ArcBallCamera()
            {
                Position = new Vertex(-10, -10, 10)
            };
            Camera = camera;
            Scene.CurrentCamera = camera;
        }
コード例 #2
0
        /// <summary>
        /// Creates the scene.
        /// </summary>
        private void CreateScene()
        {
            //  Create OpenGL.
            gl.Create(OpenGLVersion.OpenGL4_4, RenderContextType.DIBSection, 800, 600, 32, null);

            //   Create the scene object.
            Scene = new Scene()
            {
                OpenGL = gl
            };

            //  Initialise the scene object.
            SharpGL.SceneGraph.Helpers.SceneHelper.InitialiseModelingScene(Scene);

            //  Create a sphere.
            SharpGL.SceneGraph.Quadrics.Sphere sphere = new SharpGL.SceneGraph.Quadrics.Sphere();

            //  Add it.
            Scene.SceneContainer.AddChild(sphere);

            //  Create the arcball camera.
            var camera = new ArcBallCamera()
            {
                Position = new Vertex(-10, -10, 10)
            };

            Camera = camera;
            Scene.CurrentCamera = camera;
        }
コード例 #3
0
ファイル: FormExample5.cs プロジェクト: PlumpMath/sharpgl-3
        public FormExample5()
        {
            InitializeComponent();

            //  Create a sphere.
            SharpGL.SceneGraph.Quadrics.Sphere sphere = new SharpGL.SceneGraph.Quadrics.Sphere();
            sceneControl1.Scene.Jam(sphere);
        }
コード例 #4
0
ファイル: FormExample5.cs プロジェクト: nromik/sharpgl
        public FormExample5()
        {
            InitializeComponent();

            //  Create a sphere.
            SharpGL.SceneGraph.Quadrics.Sphere sphere = new SharpGL.SceneGraph.Quadrics.Sphere();
            sceneControl1.Scene.Jam(sphere);
        }
コード例 #5
0
ファイル: DrawWindow.cs プロジェクト: qizhoward/linshideGL
        public DrawWindow()
        {
            InitializeComponent();
            sceneControl.MouseWheel += SceneControl_MouseWheel;
            AutoScaleMode            = AutoScaleMode.Dpi;

            //  Create a sphere.
            SharpGL.SceneGraph.Quadrics.Sphere sphere = new SharpGL.SceneGraph.Quadrics.Sphere();
            sphere.Transformation.TranslateX = 1;
            sphere.Transformation.TranslateY = 1;

            sceneControl.Scene.SceneContainer.AddChild(sphere);
        }
コード例 #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FormHitTestSample"/> class.
        /// </summary>
        public FormHitTestSample()
        {
            InitializeComponent();

            //  Create a sphere.
            SharpGL.SceneGraph.Quadrics.Sphere sphere = new SharpGL.SceneGraph.Quadrics.Sphere();
            sphere.Transformation.TranslateX = 2;
            sphere.Transformation.TranslateY = 2;

            //  Create a cone.
            SharpGL.SceneGraph.Quadrics.Cylinder cone = new SharpGL.SceneGraph.Quadrics.Cylinder()
            {
                Name = "Cone"
            };
            cone.BaseRadius = 1.5;
            cone.TopRadius  = 0;
            cone.Height     = 2;
            cone.Transformation.TranslateX = -2;
            cone.Transformation.TranslateY = -2;

            //  Create a cylinder.
            SharpGL.SceneGraph.Quadrics.Cylinder cylinder = new SharpGL.SceneGraph.Quadrics.Cylinder()
            {
                Name = "Cylinder"
            };
            cylinder.BaseRadius = 1.5;
            cylinder.TopRadius  = 1.5;
            cylinder.Height     = 2;
            cylinder.Transformation.TranslateX = -2;
            cylinder.Transformation.TranslateY = 2;


            //  Create a cube.
            Cube cube = new Cube();

            cube.Transformation.TranslateX = 2;
            cube.Transformation.TranslateY = -2;
            cube.Transformation.RotateZ    = 45f;

            //  Add them.
            sceneControl1.Scene.SceneContainer.AddChild(sphere);
            sceneControl1.Scene.SceneContainer.AddChild(cube);
            sceneControl1.Scene.SceneContainer.AddChild(cone);
            sceneControl1.Scene.SceneContainer.AddChild(cylinder);
        }
コード例 #7
0
ファイル: FormHitTestSample.cs プロジェクト: hhool/sharpgl
        /// <summary>
        /// Initializes a new instance of the <see cref="FormHitTestSample"/> class.
        /// </summary>
        public FormHitTestSample()
        {
            InitializeComponent();

            //  Create a sphere.
            SharpGL.SceneGraph.Quadrics.Sphere sphere = new SharpGL.SceneGraph.Quadrics.Sphere();
            sphere.Transformation.TranslateX = 2;
            sphere.Transformation.TranslateY = 2;

            //  Create a cone.
            SharpGL.SceneGraph.Quadrics.Cylinder cone = new SharpGL.SceneGraph.Quadrics.Cylinder() { Name = "Cone" };
            cone.BaseRadius = 1.5;
            cone.TopRadius = 0;
            cone.Height = 2;
            cone.Transformation.TranslateX = -2;
            cone.Transformation.TranslateY = -2;

            //  Create a cylinder.
            SharpGL.SceneGraph.Quadrics.Cylinder cylinder = new SharpGL.SceneGraph.Quadrics.Cylinder() { Name = "Cylinder" };
            cylinder.BaseRadius = 1.5;
            cylinder.TopRadius = 1.5;
            cylinder.Height = 2;
            cylinder.Transformation.TranslateX = -2;
            cylinder.Transformation.TranslateY = 2;

            //  Create a cube.
            Cube cube = new Cube();
            cube.Transformation.TranslateX = 2;
            cube.Transformation.TranslateY = -2;
            cube.Transformation.RotateZ = 45f;

            //  Add them.
            sceneControl1.Scene.SceneContainer.AddChild(sphere);
            sceneControl1.Scene.SceneContainer.AddChild(cube);
            sceneControl1.Scene.SceneContainer.AddChild(cone);
            sceneControl1.Scene.SceneContainer.AddChild(cylinder);
        }