Embedding Imgui into personal project causes text on windows to render as white blocks · Issue #10 · SFML/imgui-sfml (original) (raw)

Hello!

This might not be something that you, Elias, can find a solution for, considering that my project is rather large, but this is worth a shot in case a solution IS found and others have the same problem as me. :)

Following the tutorial you provided on your blog as an introduction to Imgui, I was able to create the sample window with no problem -- the text was rendering properly. However, upon using the same code in my own project, the text only renders as white blocks.

capture5

Clearly, this is an issue with either my code, or my makefile (but everything seems to be linking correctly). The functions in which the Imgui code is embedded are called in the correct order in which the Imgui window should be constructed.

Below is how I am using Imgui. Granted, this is only one file of many in my project (these functions are being called by a separate class). Is there something that I'm failing the understand about how the Imgui window gets constructed?

TestState::TestState(std::string stateID, CRE::App& theApp):
    CRE::State(stateID, theApp),
    deltaClock()
{
}

TestState::~TestState()
{}

void TestState::init()
{
    CRE::State::init();
    ImGui::SFML::Init(_theApp._window);
}

void TestState::reinit()
{

}


void TestState::pause()
{
    CRE::State::pause();
}

void TestState::resume()
{
    CRE::State::resume();
}

void TestState::handle_events(sf::Event theEvent)
{
    ImGui::SFML::ProcessEvent(theEvent);
}

void TestState::update()
{
}

void TestState::update_variable(float elapsedTime)
{
    update_imgui();
}

void TestState::update_imgui()
{
    ImGui::SFML::Update(deltaClock.restart());
    ImGui::Begin("Test Window");
    ImGui::Button("THis is a button");
    ImGui::End();
}

void TestState::draw()
{
    _theApp._window.clear();
    ImGui::Render();
}

void TestState::handle_cleanup()
{
    ImGui::SFML::Shutdown();
}

Note that TestState::update_imgui() is only being called once every frame, and "window.display()" is called outside of this file.

I will continue to dabble until I find a solution to my problem. I'm sure I'm doing something really dumb.