You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When calling '''ImGui::Image''' in a modal window, it renders garbage for the first call, then works fine. In popup window it works perfectly fine. It seems to be a bug and I don't know whether it is a SFML related issue or not, so I posted it here.
I have tried with '''ImGui::ImageButton''' too, the bug is the same (except all calls fail to draw the texture).
I have resized the image to see it bigger. It appears it is the font texture.
Screenshots/Video
Standalone, minimal, complete and verifiable example:(see #2261)
#include <SFML/Graphics.hpp>
#include "imgui-SFML.h"
#include "imgui.h"
int main()
{
sf::RenderWindow window(sf::VideoMode(1200, 800), "My window");
ImGui::SFML::Init(window);
sf::Texture texture;
texture.loadFromFile("assets/dice/red_1.png");
sf::Clock clock;
while (window.isOpen()) {
//poll events
sf::Event event{};
while (window.pollEvent(event)) {
ImGui::SFML::ProcessEvent(event);
if (event.type == sf::Event::Closed)
window.close();
}
//
window.clear();
//clock
sf::Time elapsed = clock.restart();
//update ImGui
ImGui::SFML::Update(window, elapsed);
//draw main window
ImGui::Begin("main");
if (ImGui::Button("Open popup"))
ImGui::OpenPopup("popup");
if (ImGui::Button("Open modal"))
ImGui::OpenPopup("modal");
//draw popup
if (ImGui::BeginPopup("popup")) {
ImVec2 image_size(50.f, 50.f);
//draw them
for (int i = 0; i < 5; ++i) {
ImGui::Image(texture, image_size);
ImGui::SameLine();
}
ImGui::EndPopup();
}
//draw modal
if (ImGui::BeginPopupModal("modal")) {
ImVec2 image_size(50.f, 50.f);
//draw them
for (int i = 0; i < 5; ++i) {
ImGui::Image(texture, image_size);
ImGui::SameLine();
}
ImGui::EndPopup();
}
ImGui::End();
//
ImGui::SFML::Render(window);
window.display();
}
return 0;
}
The text was updated successfully, but these errors were encountered:
It works with the commit 004efd85a590343e8c9d166dc9d2524c199c9450 and above. Thank you for your time, I didn't found the issue you mentioned even though I searched.
Version/Branch of Dear ImGui:
Version: 1.88 (commit)
Back-end/Renderer/Compiler/OS
Back-ends: ImGui-SFML
Operating System: Debian bookworm
My Issue/Question:
When calling '''ImGui::Image''' in a modal window, it renders garbage for the first call, then works fine. In popup window it works perfectly fine. It seems to be a bug and I don't know whether it is a SFML related issue or not, so I posted it here.
I have tried with '''ImGui::ImageButton''' too, the bug is the same (except all calls fail to draw the texture).
I have resized the image to see it bigger. It appears it is the font texture.
Screenshots/Video
Standalone, minimal, complete and verifiable example: (see #2261)
The text was updated successfully, but these errors were encountered: