/// <summary> /// Renders the current Sceen. /// </summary> public void Render() { this.MakeCurrent(); // Make this Canvas Current, just in case there is more then one canves open. GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); // Clear Back buffer of previous frame. // call render on the sceen: if (SceenToRender != null) { SceenToRender.Render(); } GraphicsContext.CurrentContext.SwapBuffers(); // Calc FPS: m_oSW.Stop(); m_dAccumulator += m_oSW.Elapsed.TotalMilliseconds; m_iFrameCounter++; if (m_dAccumulator > 2000) { m_fps = (float)m_dAccumulator / (float)m_iFrameCounter; m_dAccumulator -= 2000; m_iFrameCounter = 0; } m_oSW.Reset(); m_oSW.Start(); }
/// <summary> /// Decreases the Zoom factor, zooming oout. /// </summary> public void DecreaseZoomScaler() { float fOldZoomSxaler = m_fZoomScaler; m_fZoomScaler *= UIConstants.ZOOM_OUT_FACTOR; if (m_fZoomScaler < UIConstants.ZOOM_MINIMUM_VALUE) { m_fZoomScaler = UIConstants.ZOOM_MINIMUM_VALUE; } RecalculateViewMatrix(fOldZoomSxaler); SceenToRender.ZoomSclaer = m_fZoomScaler; SceenToRender.Refresh(); // called so sceen elements can adjust to new zoom value. this.Invalidate(); }