summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
Diffstat (limited to 'ui')
-rw-r--r--ui/mainApplication.cpp6
-rw-r--r--ui/window.cpp8
2 files changed, 11 insertions, 3 deletions
diff --git a/ui/mainApplication.cpp b/ui/mainApplication.cpp
index 78f4fd4..bb91c21 100644
--- a/ui/mainApplication.cpp
+++ b/ui/mainApplication.cpp
@@ -2,6 +2,7 @@
#include "backends/imgui_impl_sdl2.h"
#include "game/gamestate.h"
#include "game/worldobject.h"
+#include "gfx/gl/gldebug.h"
void
MainApplication::mainLoop()
@@ -13,10 +14,13 @@ MainApplication::mainLoop()
const auto t_passed = std::chrono::duration_cast<TickDuration>(t_end - t_start);
if (gameState) {
+ glDebugScope _ {0, "Tick all game state world objects"};
gameState->world.apply(&WorldObject::tick, t_passed);
}
windows.apply(&Window::tick, t_passed);
- windows.apply(&Window::refresh);
+ if (glDebugScope _ {0, "Refresh all windows"}) {
+ windows.apply(&Window::refresh);
+ }
ImGui::UpdatePlatformWindows();
ImGui::RenderPlatformWindowsDefault();
diff --git a/ui/window.cpp b/ui/window.cpp
index c85cebe..9d8dc1a 100644
--- a/ui/window.cpp
+++ b/ui/window.cpp
@@ -1,6 +1,7 @@
#include "window.h"
#include "backends/imgui_impl_opengl3.h"
#include "backends/imgui_impl_sdl2.h"
+#include "gfx/gl/gldebug.h"
#include <glad/gl.h>
#include <glm/glm.hpp>
@@ -14,6 +15,7 @@ Window::Window(ScreenAbsCoord size, const char * title, Uint32 flags) :
void
Window::clear(float r, float g, float b, float a) const
{
+ glDebugScope _ {0};
glClearColor(r, g, b, a);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
@@ -56,8 +58,10 @@ Window::refresh() const
content->render();
// Render UI stuff here
}
- ImGui::Render();
- ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
+ if (glDebugScope _ {0, "ImGui post"}) {
+ ImGui::Render();
+ ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
+ }
swapBuffers();
}