-2

Distortion example Distortion example

I am trying to make a 3D game from scratch, and I have working code that draws 3D cubes to the screen using Graphics.drawPolygon(int[] {0,0,0}, int[] {0,0,0}, 3); using 2 per side of the cube. I am trying to make a "mask" with images, but in order to do this, I need to be able to distort my images. Is there any way of doing this? I haven't been able to find any resources on this topic online.

Thomas Fritsch
  • 9,639
  • 33
  • 37
  • 49
  • Read this [tutorial about transforming](https://docs.oracle.com/javase/tutorial/2d/advanced/transforming.html). – Thomas Fritsch Oct 24 '17 at 22:43
  • 1
    Apply a [transformation](https://docs.oracle.com/javase/tutorial/2d/advanced/transforming.html). --- http://idownvotedbecau.se/noresearch/ – Andreas Oct 24 '17 at 22:44
  • The shear transformation worked perfectly for what I'm needing! Thank you for the advice and pointing me in the right direction! – ericejs123 Oct 24 '17 at 23:03

1 Answers1

0

This is called an 'affine transform': a transform that preserves parallel lines. See java.awt.geom.AffineTransform.

user207421
  • 305,947
  • 44
  • 307
  • 483