Skip to content

Commit fd0f879

Browse files
committed
fix imgui init calls for non-GLFW backends
1 parent d47a774 commit fd0f879

4 files changed

Lines changed: 29 additions & 1 deletion

File tree

include/polyscope/render/mock_opengl/mock_gl_engine.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ class MockGLEngine : public Engine {
358358

359359
// ImGui
360360
void initializeImGui() override;
361+
void configureImGui() override;
361362
void shutdownImGui() override;
362363
void ImGuiNewFrame() override;
363364
void ImGuiRender() override;

include/polyscope/render/opengl/gl_engine_egl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ class GLEngineEGL : public GLEngine {
6969
// === ImGui
7070

7171
void initializeImGui() override;
72+
void configureImGui() override;
7273
void shutdownImGui() override;
7374
void ImGuiNewFrame() override;
7475
void ImGuiRender() override;

src/render/mock_opengl/mock_gl_engine.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1562,7 +1562,7 @@ void MockGLEngine::initialize() {
15621562
GLFrameBuffer* glScreenBuffer = new GLFrameBuffer(view::bufferWidth, view::bufferHeight, true);
15631563
displayBuffer.reset(glScreenBuffer);
15641564

1565-
if(options::uiScale < 0) { // only set from system if the value is -1, meaning not set yet
1565+
if (options::uiScale < 0) { // only set from system if the value is -1, meaning not set yet
15661566
options::uiScale = 1.;
15671567
}
15681568

@@ -1581,6 +1581,19 @@ void MockGLEngine::initializeImGui() {
15811581
configureImGui();
15821582
}
15831583

1584+
void MockGLEngine::configureImGui() {
1585+
1586+
// don't both calling the style callbacks, there is no UI
1587+
1588+
if (options::uiScale < 0) {
1589+
exception("uiScale is < 0. Perhaps it wasn't initialized?");
1590+
}
1591+
1592+
ImGuiIO& io = ImGui::GetIO();
1593+
io.Fonts->Clear();
1594+
io.Fonts->Build();
1595+
}
1596+
15841597
void MockGLEngine::shutdown() {
15851598
checkError();
15861599
shutdownImGui();

src/render/opengl/gl_engine_egl.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,19 @@ void GLEngineEGL::initializeImGui() {
436436
configureImGui();
437437
}
438438

439+
void GLEngineEGL::configureImGui() {
440+
441+
// don't both calling the style callbacks, there is no UI
442+
443+
if (options::uiScale < 0) {
444+
exception("uiScale is < 0. Perhaps it wasn't initialized?");
445+
}
446+
447+
ImGuiIO& io = ImGui::GetIO();
448+
io.Fonts->Clear();
449+
io.Fonts->Build();
450+
}
451+
439452
void GLEngineEGL::shutdown() {
440453
checkError();
441454
shutdownImGui();

0 commit comments

Comments
 (0)