protected override void OnRenderFrame(FrameEventArgs e) { if (frame >= FRAMES_TO_RENDER) { return; } GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); GL.ClearColor(System.Drawing.Color.White); GL.Enable(EnableCap.DepthTest); GL.DepthMask(true); GL.DepthFunc(DepthFunction.Lequal); GL.PointSize(6.0f); //TODO: improve current Camera implementation ActiveCamera.ApplyTransformations(); // TEST new camera implementation // TODO: steroscopic mode RenderingContext rc = new RenderingContext(); rc.View = View.CreateViewFromWindow(this); rc.Time = e.Time; rc.matricies.worldview = Matrix4.Identity; rc.matricies.projection = ActiveCamera.Projection; rc.matricies.modelview = Matrix4.Identity; rc.matricies.orientation = Quaternion.Identity; rc.cam = ActiveCamera; rc.Keyboard = this.Keyboard; // Apply the current Viewpoint Viewpoint.Apply(rc, Viewpoint.CurrentViewpoint); //this._perlin.Render(rc); ExecuteBuildTasks(rc); frame++; SwapBuffers(); }
public void Render(FrameEventArgs e) { if (reloading) { return; } _prev = DateTime.Now; GL.Disable(EnableCap.Lighting); GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); GL.ClearColor(ClearColor.X, ClearColor.Y, ClearColor.Z, ClearColor.W); GL.Enable(EnableCap.DepthTest); GL.DepthMask(true); GL.DepthFunc(DepthFunction.Lequal); GL.PointSize(6.0f); //GL.Enable(EnableCap.Blend); ActiveCamera.ApplyTransformations(); if (scene != null && scene.SceneGraph.Loaded) { RenderingContext rc = new RenderingContext(); rc.View = View.CreateViewFromWindow(this.window); rc.Time = e.Time; rc.matricies.worldview = Matrix4.Identity; rc.matricies.projection = ActiveCamera.Projection; rc.matricies.modelview = Matrix4.Identity; rc.matricies.orientation = Quaternion.Identity; rc.cam = ActiveCamera; rc.Keyboard = this.Keyboard; // Apply the current Viewpoint Viewpoint.Apply(rc, Viewpoint.CurrentViewpoint); Engine.Runtime.Draw(scene.SceneGraph, rc); if (showCrosshair && NavigationInfo.NavigationType != NavigationType.Examine) { rc.PushMatricies(); this._crosshair.Render(rc); rc.PopMatricies(); } } else { X3DProgram.Restart(); } if (e != null) { UpdateTitle(e); } #if VSYNC_ACTIVE System.Threading.Thread.Sleep(1); #else #endif }