Hey Embers,
I switched to the 0.9.3dev branch of Cinder and have phased out AntTweakBar in favor of Dear ImGui. But the application crashes when using multiple windows, two draw()
calls, and moving the ImGui rendering window across two different screens.
Specifically on line 5380 in imgui.cpp
:
IM_ASSERT(g.WithinFrameScope); // Forgot to call ImGui::NewFrame()
To narrow down the problem I lightly modified the BasicAppMultiWindowApp
Cinder Sample app. Here, there’s no crash. I render ImGui in one of the two windows, moving them across both screens - no problem.
In a new sandbox project, I split the draw callback (as opposed to a unified one in BasicAppMultiWindowApp
) as suggested by @lithium, like so:
ci::app::Window::Format test;
test.title( "Second Window" ).pos( {100, 100} );
mWindowSecondary = ci::app::App::get()->createWindow( test );
mWindowPrimary->getSignalDraw().connect( std::bind( &SandboxPerformance::drawPrimary, this ) );
mWindowSecondary->getSignalDraw().connect( std::bind( &SandboxPerformance::drawSecondary, this ) );
auto options = ImGui::Options().window( mWindowPrimary );
ImGui::Initialize( options );
But now, unlike BasicAppMultiWindowApp
, the application crashes when I render any ImGui elements in the primary window and it crosses into a different screen. Is there some context sharing or something going on I don’t get?
I also noticed that binding the primary draw call doesn’t appear to unbind the existing call to plain draw()
, which surprises me a tad. But to be honest I’m a bit clueless here given how similar the single draw()
call and dual draw()
call approach appears.
I wonder if this is related to this topic?
Thanks in advance,
Gazoo