protected override void OnRenderFrame(FrameEventArgs e) { GL.LoadIdentity(); GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); //Graphics.DrawCoordinatesSystem(80f); Graphics.CreateCoordinatesSystem(() => { GL.Rotate(Rotation, 0, 0, 1); Objects.DrawBench(); }); //Graphics.CreateCoordinatesSystem(() => //{ // GL.Translate(0, 100f, 0); // GL.Rotate(alpha * 5, 0, 0, 1); // Graphics.DrawCoordinatesSystem(20f); // Graphics.DrawCylinder((0, 0f, 0), 3f, 30f, Color.Pink); // Graphics.DrawSphere((0, 15f, 0), 3f, Color.DeepPink); // Graphics.DrawSphere((-3.5f, -15f, 0), 5f, Color.HotPink); // Graphics.DrawSphere((3.5f, -15f, 0), 5f, Color.HotPink); //}); Graphics.CreateCoordinatesSystem(() => { GL.Translate(0, 15f, 0); Graphics.DrawCylinder((0, 0, 0), 1.5f, 2f, 5f, Color.Green, Color.Black); Graphics.DrawSphere((0, 0, 0), 5f, Color.FromArgb(100, Color.HotPink)); }); Graphics.CreateCoordinatesSystem(() => { GL.Translate(0, -12f, 0); Graphics.DrawParallelepiped((-100f, 0, 60f), (100f, -5f, -60f), Color.Gray, Color.Black); }); Graphics.CreateCoordinatesSystem(() => { GL.Translate(-50f, 0, 0); Graphics.DrawPyramid((0, 5f, 0), 10f, 10f, 10f, Color.Yellow, Color.Black); }); Graphics.CreateCoordinatesSystem(() => { GL.Translate(-80f, 0, 0); Graphics.DrawTruncatedPyramid((0, 5f, 0), 5f, 15f, 10f, 7f, 10f, Color.Green, Color.Black); Graphics.DrawSphere((0, 5f, 0), 1f, Color.Red); }); Context.SwapBuffers(); alpha += 1.0; if (alpha > 360) { alpha -= 360; } base.OnRenderFrame(e); }
protected override void OnLoad(EventArgs e) { Graphics.Initialize(this); CursorVisible = false; CursorGrabbed = true; GL.ClearColor(BackgroundColor); GL.Enable(EnableCap.DepthTest); GL.Enable(EnableCap.Blend); GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha); this.Camera = new Camera(this); var mouseState = Mouse.GetState(); Camera.LastMousePos = new Vector2(mouseState.X, mouseState.Y); base.OnLoad(e); }