Game Development Reference
In-Depth Information
Since the tile on the left is completely seamless in all directions, we can place many of
them side by side and create a bigger texture on the surface. One way of achieving this is
by creating the larger image in an image editor, such as Microsoft Paint, GIMP, or Pho-
toshop. However, that image will require more memory, which we do not necessarily want
to give up. There is an alternative way where we load only the tile in a GPU memory and
use it as a repeated texture over a given surface.
Our tile has dimensions 128;221, and we are replicating the tile three times on the x axis
and two times on the y axis; meaning that we end up with a surface the size of 384;442.
For such a shape, it is only logical to use the RectangleShape class. Here is our setup:
If we try to render the shape in its current shape, the result does not seem promising—the
texture is just stretched on the whole surface of the rectangle. We need to configure the
Search WWH ::




Custom Search