Пример #1
0
        public RenderControl(GraphicsMode mode, int major, int minor, GraphicsContextFlags flags) : base(mode, major, minor, flags)
        {
            if (DesignMode)
            {
                return;
            }

            Resize += (sender, args) =>
            {
                GL.Viewport(0, 0, Width, Height);
                Camera?.SetViewport(Width, Height);
            };

            Context.MakeCurrent(null);
            MakeCurrent();
            Context.ErrorChecking = true;

            GL.ClearColor(Color4.Black);
            GL.Clear(ClearBufferMask.DepthBufferBit | ClearBufferMask.StencilBufferBit);
            SwapBuffers();

            Program = new ShaderProgram();
            Program.AddVertexShader("./shaders/vertex.shader");
            Program.AddFragmentShader("./shaders/fragment.shader");
            Program.Link();

            Texture = new TerrainTexture();
        }