Texture Mapping Problems
Rendering works fine up until I try to draw anything but a rectangle. Then texture gets distorted in a pattern I remember from 3d rendering. In 3d it was fixed by dividing by Z. But in 2d I don't have Z coordinate. People tell that I still need to introduce one, even virtual, and it would magically fix it, because any u/z and v/z would interpolate linearly in texture space. I still can't imagine how would it fix it and what virtual Z to choice. I tried doing that with z=20.0, but it had no effect, producing the same distorted texture, random Z values for each vertex produce randomly distorted textures. Still Photoshop somehow handles such rect transform correctly.
In other questions they suggest a hack, to get around it, but only for trapezoid: