Game Development Reference
In-Depth Information
File formats
There are many different image file formats; however, we'll focus on two major
formats in use today:
• PNG
• DXT (Uses the .dds extension)
PNG is a well-known format, widely used online for images. It can be read by most
editing programs and has plenty of ways to load and decode the image from the file.
It supports features such as transparency and provides reasonable lossless com-
pression, making it an excellent choice for storing and editing images in lieu of a
format such as Photoshop Document ( PSD ).
DXT on the other hand was created for rendering 3D textured images, and achieved
popularity when included in both Direct3D and OpenGL. As a result DXT has many
benefits that other image formats lack when used in a game. The first and foremost
benefit is the native support on GPUs for decoding and decompressing the format.
Instead of having to load in and use the CPU to do these operations, you just need
to read the file in and send it to the GPU, which can handle the rest. This greatly
simplifies the content load process, and improves efficiency by reducing the amount
of memory and processing time needed.
Note
A DXT texture converter, texconv.exe , is included with the source code for this
chapter.
Loading
First we need to ensure the images are packaged with the game when we create
our builds for testing and for the store. To do this, we need to add the image to the
project, and ensure that the Content property is set to true . This is done through the
Properties window in Visual Studio. The simplest way to open it if it is not already
open is to select the texture file in your solution explorer and press F4 . Inside the
properties inspector (with the file selected) you will see a Content property, which
Search WWH ::




Custom Search