2D: Graphics.DrawTexture flips image - is this a bug?

Hi,

drawTexture() does weird things. It maps the texture horizontally and vertically mirrored. Plus, some pixel colors look wrong (but not all, it’s very minor “effect”).

This does not happen when using a SpriteRenderer. Any idea what I am doing wrong here? Thanks!

            SpriteRenderer renderer = new GameObject().AddComponent<SpriteRenderer>();
            Texture2D texture2D = Resources.Load("myPNG") as Texture2D;
    
            // This looks good ...
            renderer.sprite = Sprite.Create(
                texture2D,
                new Rect(0, 0, texture2D.width, texture2D.height),
                new Vector2(0, 0),
                1);
    
            // This flips texture vertically + horizontally
            Graphics.DrawTexture(new Rect(0, 0, texture2D.width, texture2D.height), texture2D);

It’s the projection matrix ( see class GL). for 3d, y axis goes upward, but for old GUI system, the y axis go downward. It’s assumed that you call Graphics.DrawTexture() in OnGUI, that’s why it follows GUI system. just flipped your Rect, or change the matrix