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 - dr.rock

Pages: [1]
1
Graphics / Re: Strange sprite rendering after rotation
« on: March 06, 2014, 07:11:24 pm »
Thanks zsbzsb!
I thought i already tried it, but it appears i enabled smoothing for background texture that is not rotated, it is so stupid  ;D
Now it seems to work OK))

2
Graphics / Strange sprite rendering after rotation
« on: March 06, 2014, 06:58:55 pm »
Hi!

I have a problem with rendering sprites.
The are rendered OK unless they are rotated.

First image shows basic sprite rendering, the second - after rotation.



Also if rotation angle is 0, 90, 270 or 360 degree there's no problem.
I tried on two different PCs (but both running linux mint), i tried to turn on V Sync, anti-aliasing, texture smoothing but no result.

Here's a code example:
void test()
{
sf::ContextSettings settings;
settings.antialiasingLevel = 8;

    sf::RenderWindow mWindow(sf::VideoMode(1024, 768), "My window", sf::Style::Default, settings );
    mWindow.setVerticalSyncEnabled(true);
    mWindow.setFramerateLimit(60);

    sf::Texture back_texture;
    back_texture.loadFromFile("assets/back.png");
    back_texture.setSmooth(true);

    sf::Sprite bgSprite;
    bgSprite.setTexture(back_texture);
    sf::Texture m_texture;
    m_texture.loadFromFile("assets/missile_tmp.png");
    sf::Sprite mSprite;
    mSprite.setTexture(m_texture);

    //!!!!!!!!!!!PROBLEM IS HERE !!!!!!!!!!!!
     mSprite.setRotation(45);

    mSprite.setPosition(300,0);

    sf::Clock clock;
        sf::Time timeSinceLastUpdate = sf::Time::Zero;
        sf::Time timePerFrame = sf::seconds( 1.0f / 60.0f );

        while( mWindow.isOpen() )
        {
        sf::Time dt = clock.restart();
                timeSinceLastUpdate += dt;

                // run at constant time intervals
                while( timeSinceLastUpdate > timePerFrame )
                {
                        timeSinceLastUpdate -= timePerFrame;

            //processInput;
            sf::Event event;
            while( mWindow.pollEvent(event) )
            {
                if (event.type == sf::Event::Closed)
                    mWindow.close();
            }
            //some update here
                }
        mWindow.clear();
        mWindow.setView(mWindow.getDefaultView());
        mWindow.draw(bgSprite);
        mWindow.draw(mSprite);
        mWindow.display();
        }
}
 


What am i doing wrong?




Pages: [1]