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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - s3binator

Pages: [1]
1
Graphics / Filtered Sprites have weird border issue when rotated
« on: February 22, 2013, 09:22:50 pm »
Hi!

Im having trouble figuring out how to deal with weird artifacts on the borders of rotated sprites when smooth filtering is on. I want smooth filtering, but is there any way to get rid of the artifacted border? Even at the art level? that I cant try? Enlarge them to see what I mean.

Pics attached

[attachment deleted by admin]

2
Graphics / Re: Iterate through sprites vs changing texture on sprite
« on: June 22, 2012, 06:14:19 pm »
Thanks guys!

3
Graphics / Iterate through sprites vs changing texture on sprite
« on: June 22, 2012, 04:24:11 am »
Do you think its better to have a new sprite loaded with a texture for every different frame and iterate through them, or to have one sprite for each specific entity that gets the texture changed when necessary. Iterating through sprites uses more memory, but how heavy is it to change the texture of a sprite? In the end what is best for keeping the cost (memory and cpu in mind) the lowest?

Thanks!

4
Awesome thanks!

5
Update, Someone on a different forum said he had the same problem and he implemented a repository for textures and just passed pointers. A work around it seems, or is it that .setTexture() only takes pointers properly? That doesnt make much sense.

6
Hi!

We're trying to construct structure for frames that are being drawn onto the window. We're using sfml library, with their sprite and texture classes. In the constructor for the frameData structure we load a texture from file then apply it to the sprite using the .setTexture() method. We either get white block or a program crash depending on the machine when we compile and run our program.

If we create do a pointer reference to texture with .setTexture() outside the constructor for frameData, it works!

All if this is with an iterator structure that iterates through the different frames. Here is the relevant code, First this is in the header for the FrameData struct:

    private:
       struct FrameData
       {
          FrameData(const std::string& fileName, int frameDelay);
   
          sf::Texture texture;
          sf::Sprite sprite;
          unsigned int frameDelay;
       };

Second, here are the actual constructors, not working:

    const sf::Sprite& SpriteAnimator::currentFrame() const
    {
       return currentFrame_->sprite;
    }
   
    SpriteAnimator::FrameData::FrameData(const std::string& fileName, int frameDelay)
    : frameDelay(frameDelay)
    {
       texture.loadFromFile(fileName);
       sprite.setTexture(texture);
    }
     

And thirdly, here is what does work:


    const sf::Sprite& SpriteAnimator::currentFrame() const
    {
       currentFrame_->sprite.setTexture(currentFrame_->texture);
       return currentFrame_->sprite;
    }
   
    SpriteAnimator::FrameData::FrameData(const std::string& fileName, int frameDelay)
    : frameDelay(frameDelay)
    {
       texture.loadFromFile(fileName);
       sprite.setTexture(texture);
    }

Any ideas about why this happens, are we missing something? We want to have the constructor work properly, the current frame is returned a lot more frequently than the texture changing, so we don't need to update the texture every time the current frame is returned.

Thank you!

Pages: [1]
anything