コード例 #1
0
        public void DrawText(int x, int y, float Depth = 1.0f)
        {
            GL.PushMatrix();
            GL.LoadIdentity();

            Matrix4 ortho_projection = Matrix4.CreateOrthographicOffCenter(0, this.Width, this.Height, 0, -1, 1);

            GL.MatrixMode(MatrixMode.Projection);

            GL.LoadMatrix(ref ortho_projection);

            GL.Enable(EnableCap.Texture2D);
            GL.BindTexture(TextureTarget.Texture2D, teststring.TextureId());

            Size size = teststring.Size();

            GL.Begin(PrimitiveType.Quads);
            GL.TexCoord2(0, 0); GL.Vertex3(x + 0, y + 0, Depth);
            GL.TexCoord2(1, 0); GL.Vertex3(x + size.Width, y + 0, Depth);
            GL.TexCoord2(1, 1); GL.Vertex3(x + size.Width, y + size.Height, Depth);
            GL.TexCoord2(0, 1); GL.Vertex3(x + 0, y + size.Height, Depth);

            GL.End();
            GL.Disable(EnableCap.Texture2D);
            GL.PopMatrix();
        }