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

Author Topic: RenderTexture rendering corruption only on Samsung mobile devices  (Read 6582 times)

0 Members and 1 Guest are viewing this topic.

tuckerlein

  • Newbie
  • *
  • Posts: 6
    • View Profile
Hello,

Note SFML version I'm on is commit 013d053 (https://github.com/SFML/SFML/commit/013d053277c980946bc7761a2a088f1cbb788f8c), which is only a handful of commits behind master at the time of writing this. On this version because of a few key iOS features.

I'm seeing behavior that is causing absolute corruption of the window's rendering when on Samsung devices (any other mobile device renders as expected, including all desktops (Windows, Mac, and Linux) that I've tested it on). The problem only happens when I use a RenderTexture to render onto, and then finally render that RenderTexture to the window. Sometimes, the output simply appears flipped, other times it's completely broken. Here are a couple of examples:



And here is the code used to render:
_renderTexture->clear(sf::Color(255, 255, 255, 0));

for (auto & camera : _cameras) {
    camera->Draw(*_renderTexture, delta);
}

_renderTexture->display();
_windowSprite->setTexture(_renderTexture->getTexture());
_window.setView(*_renderView);
sf::RenderStates states(sf::BlendNone);
_window.draw(*_windowSprite, states);

A few things to note:
  • The RenderTexture is being cleared with white clear color (saw the clear color suggestion here: https://en.sfml-dev.org/forums/index.php?topic=9350.msg83986#msg83986)
  • I am calling RenderTexture::display before actually rendering it to the window.
  • This does work as expected on almost all devices, just seems to be the Galaxy line of mobile devices that definitely don't work

It's also worth mentioning that I used to not do this and instead drew everything individually to the RenderWindow instead. This caused a weird visual problem when rendering textures that had setRepeating(true) called on them in certain scaled windows. At certain window scales you would see the repeating texture repeat 1 pixel too much and render where it shouldn't be rendering. You can see an example here: (note the thin green lines under the platforms, these lines are actually the top of the green ground being repeated in the Y direction)


These textures do not have setSmooth(true) called on them, so the OpenGL clamping should prevent this. Rendering out to a RenderTexture like my code example above does indeed fix this problem (maybe some auto sampling done by SFML when rendering to a non ideal window size?).

I've currently reverted since having this repeating texture visual bug is a lot better than the Samsung RenderTexture problem. Does anyone have any ideas on how to potentially address this?
« Last Edit: January 15, 2018, 06:58:51 am by tuckerlein »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: RenderTexture rendering corruption only on Samsung mobile devices
« Reply #1 on: January 15, 2018, 09:07:48 am »
What do you mean specifically with "Samsung mobile devices"? Can we assume that this is running Android?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

tuckerlein

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: RenderTexture rendering corruption only on Samsung mobile devices
« Reply #2 on: January 15, 2018, 03:34:01 pm »
Yes, I mean Android devices. Specifically I've seen it on Galaxy Note 5 and a Galaxy S6. Other Android devices such as Moto X4, Pixel 2, and Moto X Pure do not have this problem. iPhone also works as expected.
« Last Edit: January 15, 2018, 07:47:08 pm by tuckerlein »

wdmitry

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: RenderTexture rendering corruption only on Samsung mobile devices
« Reply #3 on: August 06, 2024, 04:16:45 pm »
I seem to have similar problem.
Rendering using RenderTexture just doesn't work from time to time. Seems like a concurrency issue.

UP:
Aha, looks like the problem was that texRender.clear(sf::Color::White); is a requirement. you can't draw on it before calling this function. event though it worked from laptop fine.
« Last Edit: August 06, 2024, 05:29:40 pm by wdmitry »

 

anything