Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Converting a sf::Image to a sf::Texture  (Read 2443 times)

0 Members and 1 Guest are viewing this topic.

TheDianamu

  • Newbie
  • *
  • Posts: 20
    • View Profile
Converting a sf::Image to a sf::Texture
« on: October 01, 2013, 12:36:53 pm »
Hi, I need to convert a image to a texture for my application, but I cannot find anywhere that tells you how to do so.

Could anybody link me to a post or a post some code or a way they would do it ?

Cheers TheDianamu

Tobberoth

  • Guest
Re: Converting a sf::Image to a sf::Texture
« Reply #1 on: October 01, 2013, 12:55:34 pm »
Hi, I need to convert a image to a texture for my application, but I cannot find anywhere that tells you how to do so.

Could anybody link me to a post or a post some code or a way they would do it ?

Cheers TheDianamu
Just check the API:
http://sfml-dev.org/documentation/2.1/classsf_1_1Texture.php

Use the loadFromImage() function to create a texture from an image.

Example:
sf::Image background;
if (!background.loadFromFile("background.jpg"))
    return -1;
sf::Texture texture;
texture.loadFromImage(background);
 

 

anything