Radegast.Rendering.SceneWindow.CreateReflectionTexture C# (CSharp) Method

CreateReflectionTexture() public method

public CreateReflectionTexture ( float waterHeight, int textureSize ) : void
waterHeight float
textureSize int
return void
        public void CreateReflectionTexture(float waterHeight, int textureSize)
        {
            GL.Viewport(0, 0, textureSize, textureSize);
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
            GL.LoadIdentity();
            Camera.LookAt();
            GL.PushMatrix();

            if (Camera.RenderPosition.Z > waterHeight)
            {
                GL.Translate(0f, 0f, waterHeight * 2);
                GL.Scale(1f, 1f, -1f); // upside down;
                GL.Enable(EnableCap.ClipPlane0);
                GL.ClipPlane(ClipPlaneName.ClipPlane0, AboveWaterPlane);
                GL.CullFace(CullFaceMode.Front);
                terrain.Render(RenderPass.Simple, 0, this, lastFrameTime);
                RenderObjects(RenderPass.Simple);
                RenderAvatars(RenderPass.Simple);
                RenderObjects(RenderPass.Alpha);
                GL.Disable(EnableCap.ClipPlane0);
                GL.CullFace(CullFaceMode.Back);
            }

            GL.PopMatrix();
            GL.BindTexture(TextureTarget.Texture2D, reflectionTexture);
            GL.CopyTexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, 0, 0, textureSize, textureSize);
        }
SceneWindow