Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: [CLOSED] RenderTexture is invisible on Android  (Read 1729 times)

0 Members and 1 Guest are viewing this topic.

dmitry_t

  • Newbie
  • *
  • Posts: 17
    • View Profile
[CLOSED] RenderTexture is invisible on Android
« on: March 14, 2018, 08:48:30 pm »
Hi!

On one of my Android devices (Lenovo K10a40, Android 6.0) a RenderTexture is not displayed on the screen. At all.
The following minimal example is enough to reproduce the issue:
Quote
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>

int main(int argc, char* argv[])
{
    sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window", sf::Style::Fullscreen);
    sf::RenderTexture texture;
    if (!texture.create(500, 500))
        return -1;

    sf::CircleShape shape(50);
    shape.setFillColor(sf::Color::White);

    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();

            if (event.type == sf::Event::Resized)
            {
                sf::Vector2f size(
                    static_cast<float>(event.size.width),
                    static_cast<float>(event.size.height));
                window.setView({{}, size});
            }
        }

        texture.clear(sf::Color::Red);
        texture.draw(shape);
        texture.display();

        window.clear();
        window.draw(shape); // visible
        window.draw(sf::Sprite(texture.getTexture())); // invisible
        window.display();
    }
}

The code is almost the same as in the reference: https://www.sfml-dev.org/documentation/2.4.2/classsf_1_1RenderTexture.php.
I have added an extra draw call to put the shape below the texture, it is visible as if there were no anything else. So there is just a circle on a black screen.

What can be wrong?
« Last Edit: August 21, 2018, 10:10:57 pm by dmitry_t »

dmitry_t

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: RenderTexture is invisible on Android
« Reply #1 on: August 21, 2018, 10:10:25 pm »
The issue seems to be fixed in SFML 2.5.0.

 

anything