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.

Topics - binbinhfr

Pages: [1]
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.


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 / 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 / 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 / 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)

Window / Keyboard options / customisation ?
« on: April 22, 2020, 10:29:06 am »
Hi there,

I read many posts, but I still don't figure out how to implement a keyboard customisation in my game... (allowing for example AZERTY / QWERTY users to remap keys like QSDZ and WASD).

More than that, some keys are not recognized (like ! exclamation or ² or §)
Is there a way to extend/override this list from my game ?

I saw that Laurent was looking at that a few years ago, but is there any news on this side ?

Pages: [1]