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 - binbinhfr

Pages: [1] 2
yes indead, the borderless fullscreen window is working. But I still wonder why the true fullscreen has a problem with SFML.

Graphics / sf::ConvexShape / speed / GPU memory ?
« on: May 02, 2020, 09:10:26 am »

concerning shapes (like sf::ConvexShape or circles), if I use a lot of them (but changing their forms), I wonder what is the most efficient way to declare them.
Are they loaded once at creation in GPU memory (like textures) ?
If I change the number of vertices (setPointCount), are they loaded again ?
What about if I change only the position of a fixed number of vertices ?

In sumary : how are they managed in memory ? This will give me hints on how to manage them in my code.

Graphics / Re: Fullscreen but half bad resolution...
« on: May 01, 2020, 12:53:03 pm »
Infact, I just found out that this problem is linked to my duplicate/mirror screens setup : I have 2 identical screens (1920x1080) puggled in the GPU card. If I disable the screen mirroring in windows 10, the problem disappear.

It's quite strange because none of the numerous commercial games that I play fullscreen (directX or OpenGL) has that problem. They all works perfectly on dual mirrored screen.

So I wonder what is the difference with SFML implementation ?

Anyone out there using SFML fullscreen and dual mirrored screen ?

PS : looking in this direction, I found an old post about the same problem :
The guy says that the problem was solved by a windows 10 update. That's not my case.

Graphics / Re: ImGui-SFML / problem with resizing cursor
« on: May 01, 2020, 11:41:21 am »
Yes it's a minor problem, but in window mode, it was not easy to resize the main window anymore. Not clean.

But I just found a workaround. For those who may need it, it consists in switching the ImGuiConfigFlags_NoMouseCursorChange flag when ImGui really needs it.

Here is the code (it's a raw copy of my code, just to understand the principle, you'll have to adapt to your own code). It must be set between the events polling and the ImGUI update.

      static ImGuiIO& ioImgui = ImGui::GetIO();

      static bool imguiHasCursorPrev = true;
      bool imguiHasCursor = ioImgui.WantCaptureMouse || ioImgui.WantCaptureKeyboard;

      if (imguiHasCursor != imguiHasCursorPrev)
         if (imguiHasCursor)
            ioImgui.ConfigFlags &= !ImGuiConfigFlags_NoMouseCursorChange;
            ioImgui.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange;
         imguiHasCursorPrev = imguiHasCursor;

note : "window" is my main sfml window.
and    cursorDefault.loadFromSystem(sf::Cursor::Arrow);


Everytime I try to switch into fullscreen mode, at the same max resolution as my windows 10 desktop (1920x1080), the screen blinks and the application switch to an undersample resolution. But if I print on screen the resolution of the mode, it displays 1920x1080...and same thing for the window size.
Here is a screenshot (that seems correct, and that is weird).

BUT it it not what I see on screen : on screen I see the same image but under sampled, with big pixels, something like :

It's weird because it seems that the resolution is recognized... But it is not the case. It's a smaller resolution, and the 1920x1080 window is mapped to this new resolution.
And when I switch back to window 10, during a moment, I see that I was not in 1920x1080 anymore (big icons, big toolbar) before desktop restores its max resolution...
Any idea ?
My GPU is Nvidia GTX1060 and it works correctly in any game in full res, fullscreen.

Here is my code :

#include <SFML/Graphics.hpp>

int main()
    auto& fsmode = sf::VideoMode::getFullscreenModes()[0];

    sf::RenderWindow window(fsmode, "Fullscreen Demo", sf::Style::Fullscreen);

    sf::Text message;
    sf::Font font;
        "resolution:" + std::to_string(fsmode.width) + "x" + std::to_string(fsmode.height) + "\n"
        +"window:" + std::to_string(window.getSize().x) + "x" + std::to_string(window.getSize().y)
    message.setPosition(10, 10);

    sf::CircleShape circleRed(50);

    circleRed.setFillColor(sf::Color(255, 0, 0));
    circleRed.setPosition(100, 100);

    double t = 0.0;

    while (window.isOpen())
        sf::Event event;

        while (window.pollEvent(event))
            switch (event.type)
                case sf::Event::Closed:
                case sf::Event::KeyReleased:
                    if (event.key.code == sf::Keyboard::Key::Escape)

    return 0;

Graphics / Re: ImGui-SFML / problem with resizing cursor
« on: April 30, 2020, 11:36:58 pm »
no one encounters this problem of resize cursor (double arrow) not appearing correctly on window borders ? I really don't understand why it does not appear anymore when I'm using ImGui-SFML...

Graphics / ImGui-SFML / problem with resizing cursor
« on: April 28, 2020, 11:39:21 pm »

this thread is about a problem encountered in ImGUI-SFML, a backend to the wonderful ImGUI, written using SFML by @eliasdaler.

the problem is described here :
and also here with screenshots :

It concerns the resizing cursor that does not show anymore on the main window borders, when the cursor is handled by the ImGui-SFML (on ImGUI widgets only, not on the rest of the app). It does not show, but the resizing still works.

As you can read, I got in touch with @eliasdaler to solve this problem, but he thinks that it comes from SFML, so we will see if people around here can find an idea...  ;)

Window / Minimized and maximized events ?
« on: April 28, 2020, 12:06:02 pm »

I search the forum, but it seems that there is no way to catch the minimized or maximized events coming from Windows, am I right ?

I understand that we can deal with the window API using the handle of the SFML window and ShowWindow  and so on, but we still cannot catch these events.

Is it planned to integrate these two simple events ?
Or is there a workaround that I could use ?

Example 1 : it would be nice to know when the window is minimized, in order to pause the application for example, until it is shown back.

Example 2 :  it would be nice to catch the maximized button, because, for the moment, if I press the maximize button, the window gets wider, but if I press it again, it does not retrieve its initial size, like the usual windows behaviour. If we were able to catch the event, we could deal with this and restore an initial size.

Graphics / Re: Sprite multiple draw ?
« on: April 27, 2020, 12:10:55 am »
ok, thx for this clarification.
All is working fine, now that I understand all this stuff  8)

Graphics / Re: Texture instance copy ?
« on: April 25, 2020, 08:41:14 pm »
If you copy it then it's safe, if you keep a reference on it then you have UB, like with any other destroyed variable that you'd try to access through a pointer or reference.

OK. thx. I was using the reference copy, and the UB was positive, thats' why I was confused. So I will correct this.

Graphics / Texture instance copy ?
« on: April 25, 2020, 07:36:09 pm »

I'm not sure about this one, because I know that textures are stored into GPU memory.
so if I write
(click to show/hide)

is it ok for sprite1 ?
does the texture::operator= really duplicate textures in GPU memory ?

And what about the return of RenderTexture::GetTexture(), if I use it once the render texture is destroyed ? My tests show s that it seems to work, but I wonder if it is intended/safe or just a memory shadow ?

Graphics / Re: Sprite multiple draw ?
« on: April 25, 2020, 10:05:32 am »
thx Hapax.

Very useful.
But if I understood correctly, this large sprite will be limited by the max size of a single sprite/texture in my GPU. So If I want a larger background, I have to repeat this sprite manually, right ?

Graphics / Re: Sprite multiple draw ?
« on: April 24, 2020, 08:45:11 pm »
... then it is perfectly possible.

Oh, so I was right to ask this newbie question  ;D

I'll have a look at the shaders.

Thanks for your help and for SFML.

Graphics / Sprite multiple draw ?
« on: April 24, 2020, 07:40:30 pm »
Before going into programing, I'd like just a clarification (from a newbie). I tested textures, sprites, and repeated textures on sprites larger than the texture, but I wanted to be sure :
in a same "pre-render drawing session",  is it possible to use the same sprite multiple times to draw it on the screen ? I suppose no...

Said in another way : in order to draw repeatively a sprite on a non regular pattern, I must create several sprites from the same texture and draw them wherever I want, yes ?

Or another example : if I want to create a repeated background that could be zoomed out as far as I want, there is no "infinite repeated sprite" available : at a moment I have to repeat manually a texture by duplicating enough sprites to cover my screen ? (even if the sprite itself, within its limits, can be constructed from a repeated texture)

For another time, please don't bump all threads related to your specific situation. ;)

Yes, sorry, I thought it might notify different users who subscribed to these different threads and who could answer my question... But you received ALL the notifications  :( .

Pages: [1] 2