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

Pages: [1]
1
Network / sf::Packet is probably not endianness-safe
« on: July 06, 2020, 11:25:37 pm »
Since there is no code handling it for floats and doubles, I think sf::Packet is not completely endianness-safe.
Also it doesn't seem to support non-IEC-559 floats and doubles, but it's even rarer.

Is it worth opening an issue?
I don't have a big-endian machine to test this on, unfortunately.

I think either the code or the doc needs to be changed accordingly if this is confirmed.
Either the doc by saying it's not safe for floats and doubles, or the code by actually handling it (but it might be hard to test considering big-endian machines are rare nowadays).

2
Ok so I found out why I had this weird behaviour with glUniformMatrix4fv.

The OpenGL context doesn't keep bound shaders, and since I don't bind already bound shaders, it considers that nothing is bound.
This is another important issue imo.

3
SFML only ensures its own states, since it can't know of your custom states, as such it's your responsibility to keep track of your own states.
Yep, that's why I'm requesting for a feature to toggle fullscreen mode during runtime, because this is the right way to fix this problem. Users shouldn't have to keep track of their OpenGL state.

glfw, SDL and most of the window/OS event management libraries I know are capable of setting a window to fullscreen, I don't understand why SFML can't.

I'm still working on this, but don't forget that you can just google search the forum as well with the site:en.sfml-dev.org appended to your text query. ;)
Oh right! I didn't think about that haha


That being said, I've been trying to debug the glUniformMatrix4fv issue all day, no progress so far.
I get a GL_INVALID_OPERATION code on these calls, but I can't find the origin of the problem, and there's many many possibilities: https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glUniform.xhtml#errors

This bug is weird because:
  • It used to work perfectly using SDL
  • Only the title screen is impacted, other game states (that share the exact same rendering code) are not impacted
  • When I click blindly on a title screen button during black screen, the new state (ex settings menu) will render properly, and if I back to title screen, the title screen will render properly too

The error is vague, and I just can't find what could cause it.

And all of this (glEnable/glDisable/glClearColor + GL_INVALID_OPERATION) is because of the lack of a proper way to toggle fullscreen mode.

4
Yes, hopefully it keeps the OpenGL context, so my textures/VBO/VAO/shaders seems fine after window re-creation.

The fact that those states aren't shared is one of the issues, yes. However I've one more problem but I didn't dig into it yet, and I don't think this is related to glEnable/glDisable/glClearColor so I'll post more infos here when I'll have the time to debug it (probably today)

The symptom I noticed is glUniform4fv calls failure + black screen after toggling fullscreen mode on a 2D-only game state (using my own 2D rendering code, not the Graphics module).

5
Of course I did.

What I said about glEnable/glDisable/glClearColor is verified, and there is other obscure bugs I don't completely understand yet. I'll dig into them later today.

6
Feature requests / Raw mouse input/mouse delta
« on: May 12, 2020, 02:55:46 am »
Hello,

The search feature of this forum is currently broken on my end so I don't know if anybody already posted this request.

An user already created a PR for that feature, that works on both Windows and Linux: https://github.com/SFML/SFML/pull/1383

This post is here to request that feature on other OS, in order to make it available for a future SFML version.

This feature is mandatory to have a viable mouse-controlled FPS camera.
There is hacky ways to implement something like this without it, but they're far from perfect and have many flaws.

What do you think about this?

7
Feature requests / Ability to toggle fullscreen mode during runtime
« on: May 12, 2020, 02:49:06 am »
Hello,

The search feature of this forum is currently broken on my end so I don't know if anybody already posted this request.

However, I found those issues:

When using SFML for an OpenGL program (so, without using sf::RenderWindow) the only way to switch to fullscreen mode is to recreate the window.

This may not be a problem when using sf::RenderWindow because this class probably saves the OpenGL state and is able to restore it when the window is recreated.

However, when using sf::Window, users will have to save the paramters sent to sf::Window::create() + the current OpenGL state (calls to glEnable/glDisable/glClearColor and probably other things).

This is a real problem because it causes obscure bugs, and imo it shouldn't be up to the users to deal with that.

What is your opinion on that matter?

EDIT: Minimal example for glClearColor:

#include <SFML/OpenGL.hpp>
#include <SFML/Window.hpp>

int main(int, char **) {
        sf::ContextSettings settings;
        settings.depthBits = 24;
        settings.stencilBits = 8;
        settings.antialiasingLevel = 0;
        settings.majorVersion = 2;
        settings.minorVersion = 1;

        sf::Window window;
        window.create(sf::VideoMode(800, 600), "OpenGL", sf::Style::Close, settings);
        auto desktop = sf::VideoMode::getDesktopMode();
        window.setPosition(sf::Vector2i(
                desktop.width / 2 - window.getSize().x / 2,
                desktop.height / 2 - window.getSize().y / 2
        ));

        glClearColor(0.0f, 1.0f, 1.0f, 1.0f);

        bool running = true;
        bool fullscreen = false;
        while (running) {
                sf::Event event;
                while (window.pollEvent(event)) {
                        if (event.type == sf::Event::Closed || (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Escape)) {
                                running = false;
                        }
                        else if (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::A) {
                                window.create(sf::VideoMode(800, 600), "OpenGL", sf::Style::Close, settings);
                        }
                        else if (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Z) {
                                window.create(sf::VideoMode(800, 600), "OpenGL", sf::Style::Close, settings);

                                auto desktop = sf::VideoMode::getDesktopMode();
                                window.setPosition(sf::Vector2i(
                                        desktop.width / 2 - window.getSize().x / 2,
                                        desktop.height / 2 - window.getSize().y / 2
                                ));

                                glClearColor(0.0f, 1.0f, 1.0f, 1.0f);
                        }
                }

                glClear(GL_COLOR_BUFFER_BIT);

                window.display();
        }

        window.close();

        return 0;
}

When you press 'A', the window is recreated but nothing is setup, so it resets to its original position and the clear color goes back to black.
When you press 'Z', the window is recreated but both the position and the clear color are setup again so it's fine.

However, I don't think the user should have to store and re-setup all those things (position, video mode, caption, style, context settings, glEnable/Disable/ClearColor, etc...).

Pages: [1]
anything