Game Development Reference
In-Depth Information
Padding your images inside a texture atlas helps you avoid an issue
called texture bleeding (also known as pixel bleeding) while texture
filtering and/or mipmapping are enabled.
The texture filter mode can be set to smooth pixels of a texture. This is
basically done by looking for the pixel information that is next to the
current pixel that is to be smoothened. The problem here is that if there
is a pixel of a neighboring subimage, its pixels can also be taken into
account, which results in an unwanted effect of pixels bleeding from
one subimage to another.
For the TexturePacker, the following preparations need to be done beforehand as it is
a so-called extension to LibGDX that is not a part of the core functionality:
1.
Go to
C:\libgdx\
and extract
extensions/gdx-tools.jar
from the
l
libgdx-1.2.0.zip
file you downloaded earlier in
Chapter 1
,
Introduction to
LibGDX and Project Setup
.
2.
Put the
gdx-tools.jar
file in the
CanyonBunny-desktop/libs
subfolder.
Next, the extension has to be added to
Build Path
in Eclipse.
3.
In Eclipse, right-click on the
CanyonBunny-desktop
project and navigate to
Build Path
|
Configure Build Path
|
Libraries
.
4.
Then, click on the
Add JARs
button, which will open a new window titled
JAR selection
that shows a list of projects.
5.
In this list, search for the
CanyonBunny-desktop
project and expand it until
you reach the
libs
subfolder.
6.
Finally, select the newly added
gdx-tools.jar
extension and confirm each
opened window by clicking on their
OK
buttons.
For Gradle users, adding
gdx-tools
is easy; we just need to add the
following highlighted line to the
build.gradle
file in
C:/libgdx
:
project(":desktop") {
…
compile "com.badlogic.gdx:gdx-tools:$gdxVersion"
Make sure that you are editing under the section
project(":desktop")
. After editing, we need to refresh our
dependencies. To do this, right-click on the
CanyonBunny-desktop
project and go to the
Refresh All
option in the
Gradle
menu. Make sure
that you are connected to the Internet because Eclipse will download the
relevant dependencies.