예제 #1
0
        /// <summary>
        /// Draws a given image at the given point and the size of the image.
        /// </summary>

        /// <param name="Image">The image to draw.</param>
        /// <param name="x">The x axis.</param>
        /// <param name="y">The y axis.</param>

        public static void image(PImage Image, double x, double y)
        {
            image(Image, x, y, Image.width, Image.height);
        }
예제 #2
0
        /// <summary>
        /// Images the specified image.
        /// </summary>
        /// <param name="Image">The image.</param>
        /// <param name="x">The x.</param>
        /// <param name="y">The y.</param>
        /// <param name="width">The width.</param>
        /// <param name="height">The height.</param>

        public static void image(PImage Image, double x, double y, double width, double height)
        {
            GL.BindTexture(TextureTarget.Texture2D, (int)Image.textureID);

            GL.Begin(PrimitiveType.Quads);
            GL.Color4(tintColor);

            switch (RectangleMode)
            {
            case drawModes.Center:

                GL.TexCoord2(0, 0);
                GL.Vertex2(x - width / 2, y - height / 2);

                GL.TexCoord2(1, 0);
                GL.Vertex2(x + width / 2, y - height / 2);

                GL.TexCoord2(1, 1);
                GL.Vertex2(x + width / 2, y + height / 2);

                GL.TexCoord2(0, 1);
                GL.Vertex2(x - width / 2, y + height / 2);

                break;

            case drawModes.Radius:

                GL.TexCoord2(0, 0);
                GL.Vertex2(x - width, y - width);

                GL.TexCoord2(1, 0);
                GL.Vertex2(x + width, y - width);

                GL.TexCoord2(1, 1);
                GL.Vertex2(x + width, y + height);

                GL.TexCoord2(0, 1);
                GL.Vertex2(x - width, y + height);

                break;

            case drawModes.Corner:

                GL.TexCoord2(0, 0);
                GL.Vertex2(x, y);

                GL.TexCoord2(1, 0);
                GL.Vertex2(x + Image.width, y);

                GL.TexCoord2(1, 1);
                GL.Vertex2(x + Image.width, y + Image.height);

                GL.TexCoord2(0, 1);
                GL.Vertex2(x, y + Image.height);

                break;

            default:
                break;
            }

            GL.End();
        }