O'Reilly logo

SFML Essentials by Milcho G. Milchev

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 2. Loading and Using Textures

Textures are important, both for 2D and 3D games. They allow us to map images onto objects. In this chapter, we will look into ways of loading textures into memory and mapping them onto shapes. The Sprite class will make an appearance, and we will see how it differs from the Shape class. Finally, we will see how to keep resources safe from destruction throughout the lifetime of the game.

In this chapter, we will cover:

  • Loading textures
  • Rendering shapes with textures
  • What is a sprite?
  • Managing resources

Loading textures

Textures are quite simple objects. A 2D texture is essentially an image that is typically stored in the Graphics Processing Units' (GPU) memory. SFML provides an Image and a Texture class to process ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required