Game Development Reference
In-Depth Information
Images versus textures
The main difference between images and textures is their purpose-, manipulation and ren-
dering, respectively. The Image class handles image loading, saving, and pixel manipula-
tion, whereas the Texture class is used for rendering. These two classes differ in their be-
havior, but that doesn't change the fact that they hold the same data—an array of pixels. As
such, SFML provides simple ways of creating one from the other. For example, if we want
to load an image from a file and modify it a bit, we can then create a Texture from that
Image . However, if we then want to change the Texture object again, we have to down-
load it to Image , process it however we like, and only then upload it again as Texture .
This whole process can be expensive, and we should avoid doing it in critical sections of
the code.
Search WWH ::

Custom Search