private void LoadingScreenLoop() { GL.MatrixMode(MatrixMode.Projection); GL.PushMatrix(); GL.LoadIdentity(); GL.Ortho(0.0, (double)Screen.Width, (double)Screen.Height, 0.0, -1.0, 1.0); GL.Viewport(0, 0, Screen.Width, Screen.Height); while (!Loading.Complete && !Loading.Cancel) { CPreciseTimer.GetElapsedTime(); this.ProcessEvents(); if (this.IsExiting) { Loading.Cancel = true; } Renderer.DrawLoadingScreen(); Program.currentGameWindow.SwapBuffers(); if (Loading.JobAvailable) { while (jobs.Count > 0) { lock (jobLock) { var currentJob = jobs.Dequeue(); var locker = locks.Dequeue(); currentJob(); lock (locker) { Monitor.Pulse(locker); } } } Loading.JobAvailable = false; } double time = CPreciseTimer.GetElapsedTime(); double wait = 1000.0 / 60.0 - time * 1000 - 50; if (wait > 0) { Thread.Sleep((int)(wait)); } } if (!Loading.Cancel) { GL.PopMatrix(); GL.MatrixMode(MatrixMode.Projection); SetupSimulation(); } else { this.Exit(); } }
// Penguin private void GlcontrolOnPaint(object sender, System.Windows.Forms.PaintEventArgs e) { this.glcontrol.MakeCurrent(); GL.MatrixMode(OpenTK.Graphics.OpenGL.MatrixMode.Projection); GL.LoadIdentity(); float halfWidth = (float)(this.glcontrol.Width / 2); float halfHeight = (float)(this.glcontrol.Height / 2); GL.Ortho(-halfWidth, halfWidth, halfHeight, -halfHeight, 1000, -1000); GL.Viewport(this.glcontrol.Size); this.renderer.Render(); GL.Finish(); this.glcontrol.SwapBuffers(); this.frames++; }
public void LoadIdentity() { GL.LoadIdentity(); }