- Notifications
You must be signed in to change notification settings - Fork184
Closed
Labels
Description
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.
#include "imgui.h"#include "imgui-SFML.h"#include <SFML/System/Clock.hpp>#include <SFML/Window/Event.hpp>#include <SFML/Graphics.hpp>#include <iostream>int main(){sf::RenderWindow window(sf::VideoMode(640, 480), "");window.setFramerateLimit(60);ImGui::SFML::Init(window);bool show = true;sf::RenderTexture renderTexture;if (!renderTexture.create(32, 32)){std::cout << "error renderTexture\n";return 1;}sf::Sprite sprite(renderTexture.getTexture());sf::RectangleShape rect(sf::Vector2f(16, 16));rect.setFillColor(sf::Color::White);rect.setPosition(0, 0);renderTexture.clear(sf::Color::Green);renderTexture.draw(rect);renderTexture.display();sf::Clock deltaClock;while (window.isOpen()) {sf::Event event;while (window.pollEvent(event)) {ImGui::SFML::ProcessEvent(event);if (event.type == sf::Event::Closed) {window.close();}}ImGui::SFML::Update(window, deltaClock.restart());ImGui::Begin("Sprite Test");//ImGui will render this upside downImGui::Image(sprite);ImGui::End();ImGui::Begin("RenderTexture Test");//ImGui will render this upside downImGui::Image(renderTexture.getTexture());ImGui::End();window.clear(sf::Color::Black);//SFML renders okwindow.draw(sprite);//But IMGUI seems to render these upside downImGui::SFML::Render(window);window.display();}ImGui::SFML::Shutdown();}