コード例 #1
0
        private void RenderEntity(IGUIEntity entity)
        {
            GL.LoadIdentity();
            if (entity.GLTex != -1)
            {
                GL.Enable(EnableCap.Texture2D);
                GL.Enable(EnableCap.Blend);
                GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha);
                GL.BindTexture(TextureTarget.Texture2D, entity.GLTex);
            }

            GL.Begin(PrimitiveType.Quads);

            GL.Color3(entity.Color);
            GL.TexCoord2(0, 1);
            GL.Vertex2(entity.Position + new Vector2(-entity.Size.X / 2, -entity.Size.Y / 2));
            GL.TexCoord2(1, 1);
            GL.Vertex2(entity.Position + new Vector2(entity.Size.X / 2, -entity.Size.Y / 2));
            GL.TexCoord2(1, 0);
            GL.Vertex2(entity.Position + new Vector2(entity.Size.X / 2, entity.Size.Y / 2));
            GL.TexCoord2(0, 0);
            GL.Vertex2(entity.Position + new Vector2(-entity.Size.X / 2, entity.Size.Y / 2));

            GL.End();

            if (entity.GLTex != -1)
            {
                GL.Disable(EnableCap.Texture2D);
                GL.Disable(EnableCap.Blend);
            }
        }
コード例 #2
0
ファイル: SliderHead.cs プロジェクト: fabiankock/OpenTK_UI
        public SliderHead(Vector2 pos, Vector2 size, Color col, IGUIEntity parent)
        {
            Color    = col;
            Position = pos;
            Size     = size;

            GLTex = TextureHelper.CreateTexture("s_head");
        }