/// <summary>Rendering of the interface</summary> public virtual void OpenGLDraw() { #if MEASURE_TIME glDrawMeasure.StartCycle(); #endif GL.ActiveTexture(TextureUnit.Texture0); GL.BindTexture(TextureTarget.Texture2D, texID); if (Monitor.TryEnter(CrowInterface.RenderMutex)) { if (CrowInterface.IsDirty) { GL.TexSubImage2D(TextureTarget.Texture2D, 0, CrowInterface.DirtyRect.Left, CrowInterface.DirtyRect.Top, CrowInterface.DirtyRect.Width, CrowInterface.DirtyRect.Height, OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, CrowInterface.dirtyBmp); CrowInterface.IsDirty = false; } Monitor.Exit(CrowInterface.RenderMutex); } quad.Render(BeginMode.TriangleStrip); GL.BindTexture(TextureTarget.Texture2D, 0); #if MEASURE_TIME glDrawMeasure.StopCycle(); #endif }
void OpenGLDraw() { bool blend, depthTest; GL.GetBoolean(GetPName.Blend, out blend); GL.GetBoolean(GetPName.DepthTest, out depthTest); GL.Enable(EnableCap.Blend); GL.Disable(EnableCap.DepthTest); shader.Enable(); shader.SetMVP(projection); GL.ActiveTexture(TextureUnit.Texture0); GL.BindTexture(TextureTarget.Texture2D, texID); lock (CrowInterface.RenderMutex) { if (CrowInterface.IsDirty) { GL.TexSubImage2D(TextureTarget.Texture2D, 0, CrowInterface.DirtyRect.Left, CrowInterface.DirtyRect.Top, CrowInterface.DirtyRect.Width, CrowInterface.DirtyRect.Height, OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, CrowInterface.dirtyBmp); CrowInterface.IsDirty = false; } } quad.Render(BeginMode.TriangleStrip); GL.BindTexture(TextureTarget.Texture2D, 0); if (!blend) { GL.Disable(EnableCap.Blend); } if (depthTest) { GL.Enable(EnableCap.DepthTest); } }