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]
1
Graphics / sf::ConvexShape / speed / GPU memory ?
« on: May 02, 2020, 09:10:26 am »
Hi,

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.

2
Hi,

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 :

Quote
#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;
    font.loadFromFile("arial.ttf");
    message.setFont(font);
    message.setString(
        "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.setCharacterSize(100);
    message.setFillColor(sf::Color::White);
    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:
                    window.close();
                    break;
                case sf::Event::KeyReleased:
                    if (event.key.code == sf::Keyboard::Key::Escape)
                        window.close();
                    break;
            }
        }
       
        window.clear();
        window.draw(circleRed);
        window.draw(message);
        window.display();
    }

    return 0;
}

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

this thread is about a problem encountered in ImGUI-SFML, a backend to the wonderful ImGUI, written using SFML by @eliasdaler.
https://github.com/eliasdaler/imgui-sfml
https://github.com/ocornut/imgui

the problem is described here :
https://github.com/eliasdaler/imgui-sfml/issues/119
and also here with screenshots :
https://github.com/eliasdaler/imgui-sfml/pull/110

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...  ;)


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

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.

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

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 ?

6
Graphics / Sprite multiple draw ?
« on: April 24, 2020, 07:40:30 pm »
Hi,
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)

7
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 ?
https://www.sfml-dev.org/documentation/2.5.1/classsf_1_1Keyboard.php

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

Pages: [1]
anything