Hello,
for my JOGL based 2D game (2d sprite textures) I’m going to use some Shape objects (Ellipses, Polygons, etc) for the collision checking. Many of the objects to be tested per frame are non rectangular.
Several classes of the extensive Java2D infrastructure looks attractive for my purpose: they provide ways to check for intersection(), contains(), etc.
Since I’m new to Java2D, three questions please:
1.) Is this approach a good idea?
Or is heavy collision checking with Java2D too expensive/overkill for my non visible purpose, because basically the Java2D classes are tuned for visible objects? (Btw. all my colliding sprites have got an 8bpp alpha channel.)
Since my sprites are being rotated, scaled, and so on, I also need to do this for the collision checking.
2.) Is the correct Java2D approach to use the Area class, feed your Shape to it, apply a transform(AffineTransformation) on it and check it against other area object(s)?
Or is there a (even) simpler way?
IIRC the AffineTransform (AT) is being HW accelarated when the OpenGL pipeline is enabled.
3.) Does this only apply for drawing ATs (to Graphics2D)?
If it does also apply to non visible ATs, it there a way to use it whilst using JOGL at the same time? (I read in the forum that currently using JOGL with the Java2D’s OpenGL pipeline doesn’t work.)
Thanks!