Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sf::Texture::update() does not work properly on older Androids #2420

Open
Zombieschannel opened this issue Feb 17, 2023 · 1 comment
Open

Comments

@Zombieschannel
Copy link

Subject of the issue

So basically, I tested this on Androids 6, 8, 10, and 13. On Androids 10 and 13, the program works normally and shortly after you boot up the program you get the image below. On older Androids, it seems like after calling texture.update(), the texture is sometimes (pretty much 50/50) just black, and then it breaks the recursive image... With a higher framerate, this leads to flickering (I cannot show that with an image, but I can record a video if necessary). Also compared to #2419 the texture isn't ever flipped - everything works as it should.

image

Your environment

Android Studio 2022.1.1 on Windows 10
SFML 2.6.x branch
Used CMake, Ninja, Android NDK 25

Steps to reproduce

#include <SFML/Graphics.hpp>
int main()
{
    sf::RenderWindow window(sf::VideoMode::getDesktopMode(), "SFML works!", sf::Style::Fullscreen);
    window.setFramerateLimit(10);
    sf::CircleShape shape(400.f);
    sf::RectangleShape shape2;
    shape.setFillColor(sf::Color::Green);
    shape2.setSize(sf::Vector2f(400, 400));
    sf::Texture texture;
    texture.create(window.getSize().x, window.getSize().y);

    bool active = window.hasFocus();
    while (window.isOpen())
    {
        sf::Event event;
        bool end = 0;
        while (window.pollEvent(event))
        {
            switch (event.type)
            {
            case sf::Event::Closed:
                window.close();
                break;
            case sf::Event::LostFocus:
                window.setActive(0);
                active = 0;
                break;
            case sf::Event::GainedFocus:
                window.setActive(1);
                active = 1;
                break;
            case sf::Event::KeyReleased:
                if (event.key.code == sf::Keyboard::Escape)
                    window.close();
                break;
            }
        }

        texture.update(window);
        shape2.setTexture(&texture);
        window.clear();
        window.draw(shape);
        window.draw(shape2);
        window.display();

    }
}
@ChrisThrasher ChrisThrasher added this to Discussion in SFML 2.6.0 via automation Feb 19, 2023
@ChrisThrasher ChrisThrasher added this to the 2.6 milestone Feb 19, 2023
@Zombieschannel
Copy link
Author

Also, I feel like I have to add that this may not be related to the Android version at all. It is completely possible that the issue is related to something like the OpenGL ES version or EGL version or something else. That is all I know. I checked the source code for the texture.update() but nothing seems to be wrong - as I already mentioned, it works even on these older devices, just not always, something like 40 - 50% of the time.
Phones I used for testing:
Android 6 - Sony Xperia M5
Android 8 - Samsung Galaxy S7
Android 10 - Samsung Galaxy S9
Android 13 - Samsung Galaxy A72

@eXpl0it3r eXpl0it3r removed this from Discussion in SFML 2.6.0 Mar 5, 2023
@eXpl0it3r eXpl0it3r added this to Backlog in Android Backlog via automation Mar 5, 2023
@eXpl0it3r eXpl0it3r modified the milestones: 2.6, 2.6.1 Mar 5, 2023
@eXpl0it3r eXpl0it3r modified the milestones: 2.6.1, 2.6.2 Nov 4, 2023
@eXpl0it3r eXpl0it3r changed the title sf::Texture::update() does not work properly on older Androids sf::Texture::update() does not work properly on older Androids May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Android Backlog
  
Backlog
Development

No branches or pull requests

3 participants