Esempio n. 1
0
        public virtual void Draw(ShaderProgram shader, VAO vao, GameWindow gw)
        {
            shader.SetUniform("rect", GlobalBounds);
            shader.SetUniform("color", BackgroundColor);
            shader.SetUniform("borderWidth", BorderWidth);
            shader.SetUniform("borderColor", BorderColor);

            if (BackgroundImage != null)
            {
                BackgroundImage.Bind();
                shader.SetUniform("useTexture", true);
            }
            else
            {
                shader.SetUniform("useTexture", false);
            }

            vao.DrawArrays(OpenTK.Graphics.OpenGL.PrimitiveType.TriangleStrip);

            var temp = this as IText;

            if (temp != null && !string.IsNullOrWhiteSpace(temp.Text))
            {
                GuiManager.setScisor(GlobalBounds, BorderWidth, gw, Parent);
                temp.TextImage.Bind();
                shader.SetUniform("useTexture", true);
                shader.SetUniform("rect", temp.TextBounds);
                shader.SetUniform("borderWidth", 0);

                vao.DrawArrays(OpenTK.Graphics.OpenGL.PrimitiveType.TriangleStrip);
            }
        }