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

Author Topic: Load sf::Sprite as a subrect of sf::Image  (Read 3270 times)

0 Members and 1 Guest are viewing this topic.

kolofsson

  • Full Member
  • ***
  • Posts: 100
    • View Profile
Load sf::Sprite as a subrect of sf::Image
« on: April 25, 2010, 01:50:20 pm »
Hello. I'd like to ask, if it would be possible to implement a method to the sf:Sprite class that would look sth like this:

Code: [Select]
sf::Sprite::SetImageRect(sf::Image, sf::Rect)

If I am right, the problem with displaying large images lies on the sprite side. So if I could load a large image with sf::Image and then slice it into smaller subrectangles, supported by the graphics cards, and make sprites of them.

Is this doable? Or do I have to split the image manually to ensure, that my sprite is not too big for some old hardware? Thanks.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Load sf::Sprite as a subrect of sf::Image
« Reply #1 on: April 25, 2010, 02:09:38 pm »
You are probably looking for sf::Sprite::SetSubRect(). ;)
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

nulloid

  • Full Member
  • ***
  • Posts: 134
    • View Profile
Load sf::Sprite as a subrect of sf::Image
« Reply #2 on: April 25, 2010, 04:05:11 pm »
I think he wants something similar to Mappy. I don't know what he wants exactly, nor what Mappy is good for (just in contours), but maybe it worths a look :)

Read this: http://www.sfml-dev.org/forum/viewtopic.php?t=2508

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Load sf::Sprite as a subrect of sf::Image
« Reply #3 on: April 25, 2010, 04:14:13 pm »
Quote
If I am right, the problem with displaying large images lies on the sprite side

Wrong, it lies 100% on the sf::Image side ;)

If the solution was that easy, it would already be implemented in SFML, trust me.
Laurent Gomila - SFML developer

kolofsson

  • Full Member
  • ***
  • Posts: 100
    • View Profile
Load sf::Sprite as a subrect of sf::Image
« Reply #4 on: April 25, 2010, 07:40:32 pm »
Quote from: "nulloid"
I don't know what he wants exactly


Let me explain. Old graphic cards support very small textures, even 256x256 pixels. If you try to load an image using SFML, that is larger than this, you will get an error.

Support for textures of 2048x2048 pixels is common, but what about these poor guys who won't be able to load your program, only because the textures are too big?

 

anything