public void Render(Matrix4 model, Matrix4 view, Matrix4 projection)
        {
            GL.Color3(Color.White);

            // Set up uniforms
            _uTint.Value          = TintColor;
            _uMatModel.Value      = model;
            _uMatView.Value       = view;
            _uMatProjection.Value = projection;

//            GL.MatrixMode(MatrixMode.Projection);
//            GL.LoadMatrix(ref projection);
//            GL.MatrixMode(MatrixMode.Modelview);
//            var mat = view * model;
//            GL.LoadMatrix(ref mat);

            // Engage shader, render, disengage
            _shaderProgram.Use(_uTint, _uMatModel, _uMatView, _uMatProjection);

            GL.PushMatrix();
            GL.Translate(-SideLength * 8 + 1, 0, -SideLength * 8 + 1);
            foreach (var chunk in Chunks)
            {
                chunk?.Draw();
            }
            GL.PopMatrix();

            GL.UseProgram(0);

            // Render the ocean
            GL.Color3(Color.MediumBlue);

            var waterLevel = _generator.GetWaterLevel();
            //
            //            GL.Begin(PrimitiveType.Quads);
            //            GL.Normal3(Vector3.UnitY);
            //            GL.Vertex3(-SideLength * 8, waterLevel - 0.4, -SideLength * 8);
            //            GL.Vertex3(SideLength * 8, waterLevel - 0.4, -SideLength * 8);
            //            GL.Vertex3(SideLength * 8, waterLevel - 0.4, SideLength * 8);
            //            GL.Vertex3(-SideLength * 8, waterLevel - 0.4, SideLength * 8);
            //            GL.End();
        }
        public void Render(Matrix4 model, Matrix4 view, Matrix4 projection)
        {
            _framebuffer.Use();
            GL.PushMatrix();

            GL.Clear(ClearBufferMask.ColorBufferBit |
                     ClearBufferMask.DepthBufferBit |
                     ClearBufferMask.StencilBufferBit);

            GL.Color3(Color.White);

            // Set up uniforms
            _uTint.Value          = TintColor;
            _uLightPos.Value      = LightPosition;
            _uMatModel.Value      = model;
            _uMatView.Value       = view;
            _uMatProjection.Value = projection;
            _uSamples.Value       = _framebuffer.Samples;
            _uTexRandom.Value     = 1;

            GL.ActiveTexture(TextureUnit.Texture1);
            GL.BindTexture(TextureTarget.Texture2D, _texRandom);

            // Engage shader, render, disengage
            _shaderModel.Use(_uTint, _uLightPos, _uMatModel, _uMatView, _uMatProjection, _uSamples, _uTexRandom);

            foreach (var chunk in Chunks)
            {
                chunk?.Draw();
            }

            _shaderScreen.Release();

            // Render the ocean
            GL.Color3(Color.MediumBlue);

            var waterLevel = _generator.GetWaterLevel();

            GL.MatrixMode(MatrixMode.Projection);
            GL.LoadMatrix(ref projection);
            GL.MatrixMode(MatrixMode.Modelview);
            var mat = view * model;

            GL.LoadMatrix(ref mat);

            GL.Begin(PrimitiveType.Quads);
            GL.Normal3(Vector3.UnitY);
            GL.Vertex3(-1, waterLevel - 0.4, -1);
            GL.Vertex3(SideLength * 16 - 1, waterLevel - 0.4, -1);
            GL.Vertex3(SideLength * 16 - 1, waterLevel - 0.4, SideLength * 16 - 1);
            GL.Vertex3(-1, waterLevel - 0.4, SideLength * 16 - 1);
            GL.End();

            GL.PopMatrix();
            _framebuffer.Release();

            _framebufferUi.Use();
            GL.ClearColor(0, 0, 0, 0);
            GL.Clear(ClearBufferMask.ColorBufferBit |
                     ClearBufferMask.DepthBufferBit |
                     ClearBufferMask.StencilBufferBit);

            _nvg.BeginFrame(_window.Width, _window.Height, 1);
            _nvg.Save();

            _nvg.FillColor(NanoVg.Rgba(255, 255, 255, 255));
            _nvg.FontFace("sans");
            _nvg.FontSize(18);
            _nvg.TextAlign(NvgAlign.Top | NvgAlign.Left);

            _perfGraphFps.RenderGraph(_nvg, 4, 4);

            _nvg.Restore();

            _ui.Render(this, _nvg);

            _nvg.EndFrame();
            _framebufferUi.Release();

            _uWidth.Value     = _window.Width;
            _uHeight.Value    = _window.Height;
            _uTexColor.Value  = 0;
            _uTexUi.Value     = 1;
            _uSamples.Value   = _framebuffer.Samples;
            _uSamplesUi.Value = _framebufferUi.Samples;

            _shaderScreen.Use(_uWidth, _uHeight, _uTexColor, _uTexUi, _uSamples, _uSamplesUi);
            DrawFullscreenQuad(_framebuffer.TextureId, _framebufferUi.TextureId);
            _shaderScreen.Release();
        }