-
Notifications
You must be signed in to change notification settings - Fork 171
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::RenderTexture displays upside down #35
Comments
Okay, I'll see what I can do soon. Are you using the latest version of SFML, btw? |
Yes, sorry I should have said: |
Sorry, I forgot about the issue. So, the problem is really here and it exists because RenderTexture stores the texture upside down. The sprite renders correctly, because textures store flag about whether it has pixels flipped or not. sf::Texture::Bind handles this case, but for some reason if I use texture pointers instead of native handles in imgui-SFML code, things get really glitched. I'll take a closer look at the issue in a few days and report what I will found. UPD: No fix found :( |
For what it's worth, I've worked around this temporarily by just copying all the |
Yes, I think that's the right way to do it for now. The problem is that if the user passes I think I'll overload |
Didn't see the code, but usually a flipped texture is 90% of the time due to a forgotten ".display()" call... |
No, here the problem is that RenderTexture stores flipped texture. I think I need to add overload for it which will flip it, just like JohnyPtn said. :) |
Uh huh, this is part of the 10% :P example solution:
|
Also found this flipping issue already reported in 2010 and no solution yet for me or any other designer. I really need to render the menu-card to renderTextures, then add them to the sf::View to create a swipe experience... else sfml is really too slow, especially in Chinese. My menu card is suddenly upside down :-( Because of lower performance compare to SDL, this verticle shit and not able to update parts of the screen I have to stick with SDL, although SFML seems to have a very clear interface for C++... too bad. :-( I hope they will improve in the future and also change to utf-8 because utf-32 becomes a nightmarre. |
@barthoukes does the solution from @JonnyPtn work for you for ImGui-SFML? |
I'm not really sure where to start with that comment... but here goes:
And regards to your SFML comments:
Most of your comment Is SFML related, so best not to discuss it here anyway, join us in the SFML Discord (or IRC) channel if you want to discuss them |
Hi @eliasdaler , I bumped into the same flipped texture problem...
and this in imgui-SFML.h
Anyway, thx for your code @eliasdaler , it's great ! |
thanks @JonnyPtn, your solution solved the problem, now everything works correctly. |
Please check out this branch: So, here's the thing. I can add ImGui::TextUnformatted("RenderTexture");
ImGui::Image(renderTexture);
ImGui::SameLine();
ImGui::ImageButton(renderTexture);
ImGui::TextUnformatted("Texture");
ImGui::Image(*sprite.getTexture());
ImGui::SameLine();
ImGui::ImageButton(*sprite.getTexture());
ImGui::TextUnformatted("Sprite");
ImGui::Image(sprite);
ImGui::SameLine();
ImGui::ImageButton(sprite); This is the best I can do, because to know if the texture comes from |
Merged the fix into the master: ee41e16 The oldest bug is now closed. Sorry for the huge procrastination on my part. |
I'm not sure if this is the same issue as #11 but RenderTextures seem to be flipped upside down. I've attached a minimal program to produce the issue. The sprite shows right-side up if I render it using RenderWindow::draw() but if I use ImGui::Image() it is upside down. Rendering the raw sf::RenderTexture using ImGui::Image() also results in an upside down image.
If I do the same test using an image loaded from a file into a sf::Texture instead of the sf::RenderTexture, everything renders just fine.
The text was updated successfully, but these errors were encountered: