private void CreateRenderContext() { // Initialises OpenGL. var renderContext = new FBORenderContext(); // Create the render context. renderContext.Create(OpenGLVersion, Width, Height, 32, null); this.renderContext = renderContext; renderContext.MakeCurrent(); // Set the most basic OpenGL styles. GL.ShadeModel(GL.GL_SMOOTH); // 天蓝色背景 GL.ClearColor(0x87 / 255.0f, 0xce / 255.0f, 0xeb / 255.0f, 0xff / 255.0f); GL.ClearDepth(1.0f); GL.Enable(GL.GL_DEPTH_TEST); GL.DepthFunc(GL.GL_LEQUAL); GL.Hint(GL.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST); }
private void DestroyRenderContext() { RenderContext renderContext = this.renderContext; if (renderContext != null) { this.renderContext = null; renderContext.Dispose(); } }