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

Author Topic: Problem with cursor and screen artifacts  (Read 1984 times)

0 Members and 2 Guests are viewing this topic.

Snake38

  • Newbie
  • *
  • Posts: 3
    • View Profile
Problem with cursor and screen artifacts
« on: April 12, 2015, 07:01:05 pm »
Hi, I think I have done something wrong but can't find what.

I have recorded video (attachment) of what is happening as it will be easiest way to show what I mean.

First (and most important): if I move my cursor some black circle is going around cursor.

My main loop is:
        while (renderWindow->isOpen())
        {
                sf::Event event;
                while (renderWindow->pollEvent(event))
                {
                        // close window
                        if (event.type == sf::Event::Closed)
                                renderWindow->close();

                        // update title with mouse position
                        if (event.type == sf::Event::MouseMoved)
                        {
                                // update title
                                auto mouseWorldPos = renderWindow->mapPixelToCoords(sf::Vector2i(event.mouseMove.x, event.mouseMove.y));
                                std::stringstream title;
                                title << Config::Window::Title.toAnsiString() << " -";
                                title << " X: " << mouseWorldPos.x;
                                title << " Y: " << mouseWorldPos.y;

                                renderWindow->setTitle(title.str());
                        }
                       
                        // resize view of render window when resized
                        if (event.type == sf::Event::Resized)
                        {
                                sf::FloatRect visibleArea(0.f, 0.f, static_cast<float>(event.size.width), static_cast<float>(event.size.height));
                                renderWindow->setView(sf::View(visibleArea));
                        }

                        if (windowCallback)
                                windowCallback->onEvent(event);
                }

                renderWindow->clear(Config::Window::ClearColor);
                if (windowCallback)
                        windowCallback->onRender();
                renderWindow->display();
        }

and I draw RectangleShapes in a loop like (it's windowCallback->onRender()):
        // [...] just assign sf::Vector2f gridSize, gridPositionStart and int verticalLinesCount
        sf::RectangleShape lineShape;
        lineShape.setSize(sf::Vector2f(1.f, gridSize.y));

        for (int i = 0; i < verticalLinesCount; i++)
        {
                lineShape.setPosition(gridPositionStart.x + i * Config::Grid::GridSpace, gridPositionStart.y);
                Render->draw(lineShape);
        }

Render is just RenderWindow.

I'm not sure where is a problem.

I'm using SFML 2.2 static with VS2013 Community.
Windows 8.1 x64 with GTX 970.

dabbertorres

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
    • website/blog
Re: Problem with cursor and screen artifacts
« Reply #1 on: April 12, 2015, 07:56:36 pm »
First and foremost: Create a complete and minimal example that demonstrates the problem. (Code that someone can copy, paste, and compile without changes to test)

Second: I don't see "some black circle" around the cursor in your video.

Snake38

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Problem with cursor and screen artifacts
« Reply #2 on: April 12, 2015, 08:25:45 pm »
Wow, it seems to be only on my computer, can't screenshoot it but I see it playing that video.

I think it is problem with my hardware/display screen or with Windows cursor, I'm on high DPI. When I disable cursor it works normal. But I do not have this problem in games (with native cursor ofc) or in Unity/UE4.

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: Problem with cursor and screen artifacts
« Reply #3 on: April 12, 2015, 08:45:31 pm »
I don't know what's going on, so all I have to offer are a few random guesses/things to try.

1. Try updating your graphics card driver.

2. Make sure your SFML is built with the exact same compiler that you use for your application.

3. Make sure you are not mixing debug and release builds of SFML and your application.

4. Try the latest 'master' branch of SFML from git.

Snake38

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Problem with cursor and screen artifacts
« Reply #4 on: April 12, 2015, 09:32:52 pm »
Thanks for ideas but it's not that.

I have latest drivers and I see it is actualy not related to SFML. It even happens in paint, but I'm not sure if it's not only OpenGL/soft. Just tested in unity and it's working ok.

@edit
In Blender and Gimp (OpenGL) it's happening.

Just so you can imagine what I'm talking about it looks like this http://i.imgur.com/oEON38X.png but only if I move the mouse (or rather when cursor is moving because when I stop video or go frame-by-frame it not happens).

@edit2
In Paint.NET (DirectX) it's not happening.

@edit3
Ok, I'm lost.

SDL (DirectX on Windows) is doing this weird thing to me but PyGame (which uses SDL) is not.
Custom cursor in SFML is still doing this to me.

@edit4
More tests, Windows GDI with a little space between lines does that (but it's not that much visible as in SFML/SDL) and wxWidgets (python binding) with Cairo drawing (I guess) does not (even with 1 px space).

Magic.
« Last Edit: April 13, 2015, 12:49:26 am by Snake38 »

 

anything