public void InitGL(CapturePreview owner) { gm = new GraphicsMode(new ColorFormat(32), 24, 8, 0); thisContext = new GraphicsContext(gm, WindowInfo); this.MakeCurrent(); this.VSync = false; GL.Viewport(0, 0, Width, Height); GL.MatrixMode(MatrixMode.Projection); GL.LoadIdentity(); GL.Ortho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0); GL.MatrixMode(MatrixMode.Modelview); GL.LoadIdentity();// Reset The View GL.ClearColor(Color.DimGray); GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); m_previewHelper = new CDeckLinkGLScreenPreviewHelper(); m_previewHelper.InitializeGL(); glIsInitialized = true; }
private void SetupPreviewBox() { int w = previewBox.Width; int h = previewBox.Height; GL.MatrixMode(MatrixMode.Projection); GL.LoadIdentity(); GL.Ortho(-1, 1, -1, 1, -1, 1); // Bottom-left corner pixel has coordinate (0, 0) GL.Viewport(0, 0, w, h); // Use all of the glControl painting area _GLHelper.InitializeGL(); GL.ClearColor(Color.SkyBlue); // So we can see the box is actually workign GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); previewBox.SwapBuffers(); previewBox.Context.MakeCurrent(null); }