From bb3b4356c360201c6c004361a5f2514dee42583b Mon Sep 17 00:00:00 2001 From: Kubat <mael.martin31@gmail.com> Date: Wed, 8 Jul 2020 20:49:02 +0200 Subject: [PATCH] Small update --- MainWindow.cpp | 34 +++++++++++++++++----------------- MainWindow.h | 4 ++++ imgui.ini | 20 ++++++++++++-------- 3 files changed, 33 insertions(+), 25 deletions(-) diff --git a/MainWindow.cpp b/MainWindow.cpp index 6b67026..60a86bf 100644 --- a/MainWindow.cpp +++ b/MainWindow.cpp @@ -138,28 +138,25 @@ MainWindow::HandleRender(void) // Rendering ImGui::Render(); - /* Always redraw */ - int w, h; - int __one__one = 1; - SDL_GetWindowSize(window, &w, &h); - mpv_opengl_fbo fbo = { - .fbo = 0, - .w = w, - .h = h, - }; - mpv_render_param params[] = { - {MPV_RENDER_PARAM_OPENGL_FBO, &fbo}, - {MPV_RENDER_PARAM_FLIP_Y, &__one__one}, - {(mpv_render_param_type)0} - }; - // mpv_render_context_render(mpv_gl, params); - SDL_Window* backup_current_window = SDL_GL_GetCurrentWindow(); SDL_GLContext backup_current_context = SDL_GL_GetCurrentContext(); ImGui::UpdatePlatformWindows(); ImGui::RenderPlatformWindowsDefault(); SDL_GL_MakeCurrent(backup_current_window, backup_current_context); - mpv_render_context_render(mpv_gl, params); + + { + int w, h; + SDL_GetWindowSize(window, &w, &h); + fbo = { + .fbo = 0, + .w = w, + .h = h, + }; + params[0] = {MPV_RENDER_PARAM_OPENGL_FBO, &fbo}; + params[1] = {MPV_RENDER_PARAM_FLIP_Y, &__fbo_one}; + params[2] = {(mpv_render_param_type)0}; + mpv_render_context_render(mpv_gl, params); + } ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData()); @@ -236,6 +233,9 @@ MainWindow::HandleLayers(void) ImGui_ImplSDL2_NewFrame(window); ImGui::NewFrame(); + // ImGuiID dockspace_id = ImGui::GetID("MyDockSpace"); + // ImGui::DockSpace(dockspace_id, ImVec2(0.0f, 0.0f)); + // 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!). if (show_demo_window) ImGui::ShowDemoWindow(&show_demo_window); diff --git a/MainWindow.h b/MainWindow.h index a8f63e1..5e9ab59 100644 --- a/MainWindow.h +++ b/MainWindow.h @@ -26,6 +26,10 @@ private: bool done; + int __fbo_one = 1; + mpv_opengl_fbo fbo; + mpv_render_param params[3]; + static Uint32 wakeup_on_mpv_render_update, wakeup_on_mpv_events; /* Need to be static */ static std::shared_ptr<MainWindow> self; diff --git a/imgui.ini b/imgui.ini index c988e61..073ac20 100644 --- a/imgui.ini +++ b/imgui.ini @@ -1,18 +1,16 @@ [Window][Debug##Default] -Pos=60,60 -Size=400,400 +Pos=629,35 +Size=1219,824 Collapsed=0 [Window][Hello, world!] -ViewportPos=165,1 -ViewportId=0xEBE6C6E6 -Size=630,377 +Pos=1450,62 +Size=390,789 Collapsed=0 [Window][Dear ImGui Demo] -ViewportPos=1160,4 -ViewportId=0xE927CF2F -Size=738,485 +Pos=213,94 +Size=418,784 Collapsed=0 [Window][Another Window] @@ -80,5 +78,11 @@ Pos=503,51 Size=771,465 Collapsed=0 +[Window][Render] +Pos=25,17 +Size=349,1016 +Collapsed=0 + [Docking][Data] +DockSpace ID=0xF852211D Pos=637,80 Size=1203,789 CentralNode=1 -- GitLab