Will I get performance gains from using a texture atlas with JavaFX Canvas and rendering sub-images?

192 Views Asked by At

I am developing a game using JavaFX for an assignment. I am familiar with texture atlases and the fact that they bring performance improvements (I've previously worked on similar projects using LibGDX). Does this apply to JavaFX's Canvas specifically?

In other words, is it worth making a texture atlas for my assets and using this single image instead of using a separate image for each asset? I am asking because I am unfamiliar with how Canvas and GraphicsContext is implemented.

If I did use a texture atlas, I would use the

writeImage(Image img, double dx, double dy, double dw, double dh, double sx, double sy, double sw, double sh)

method of GraphicsContext, which I assume is efficient.

Otherwise, I would have separate Image instances for each asset.

0

There are 0 best solutions below