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

Author Topic: Artifacts in isometric view  (Read 3182 times)

0 Members and 1 Guest are viewing this topic.

bastien

  • Full Member
  • ***
  • Posts: 231
    • View Profile
    • http://bastien-leonard.alwaysdata.net
Artifacts in isometric view
« on: October 29, 2010, 11:02:16 am »
I'm writing an isometric tile engine, and I can't seem to correctly piece the tiles together. There is always some kind of shadow. In the end it makes the map look like there's a grid, which isn't that bad, but I'd like to show a plain grass map. How can I achieve that?

Note: I have the same problem on two different computers, on both Windows and GNU/Linux.

Here is a simple example, with 64x30 tiles:



Code: [Select]
#include <iostream>
#include <vector>

#include <SFML/Graphics.hpp>


int main()
{
    sf::RenderWindow app(sf::VideoMode(640, 480, 32), "Tile test");
    app.SetFramerateLimit(10);
    sf::Image image;
    bool running = image.LoadFromFile("grass.png");
    std::vector<sf::Sprite> sprites;

    sf::Sprite s1(image);
    s1.SetPosition(0, 0);
    sprites.push_back(s1);
    sf::Sprite s2(image);
    s2.SetPosition(64, 0);
    sprites.push_back(s2);
    sf::Sprite s3(image);
    s3.SetPosition(32, 15);
    sprites.push_back(s3);
   
    while (running)
    {
        sf::Event event;

        while (app.GetEvent(event))
        {
            switch (event.Type)
            {
            case sf::Event::Closed:
                running = false;
                break;
            default:
                break;
            }
        }

        app.Clear(sf::Color(255, 255, 255));

        for (std::vector<sf::Sprite>::const_iterator it = sprites.begin();
             it != sprites.end();
             ++it)
        {
            app.Draw(*it);
        }

        std::cout << 1.0 / app.GetFrameTime() << " FPS\n";
        app.Display();
    }

    app.Close();

    return EXIT_SUCCESS;
}


Here is the tile:

Check out pysfml-cython, an up to date Python 2/3 binding for SFML 2: https://github.com/bastienleonard/pysfml-cython

Thiziri

  • Jr. Member
  • **
  • Posts: 87
    • View Profile
Artifacts in isometric view
« Reply #1 on: October 29, 2010, 12:24:53 pm »
sf::Image::SetSmooth(false) ?

bastien

  • Full Member
  • ***
  • Posts: 231
    • View Profile
    • http://bastien-leonard.alwaysdata.net
Artifacts in isometric view
« Reply #2 on: October 29, 2010, 08:11:49 pm »
Thanks, it works perfectly. But for some reason it doesn't work in Python. :| Apparently it's a bug in the binding.
Check out pysfml-cython, an up to date Python 2/3 binding for SFML 2: https://github.com/bastienleonard/pysfml-cython

 

anything