/// <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; }
/// <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; }
public FormExample5() { InitializeComponent(); // Create a sphere. SharpGL.SceneGraph.Quadrics.Sphere sphere = new SharpGL.SceneGraph.Quadrics.Sphere(); sceneControl1.Scene.Jam(sphere); }
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); }
/// <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); }