diff --git a/examples/align-advanced/CMakeLists.txt b/examples/align-advanced/CMakeLists.txt index 7e17b5e6ab4..5e24752a65f 100644 --- a/examples/align-advanced/CMakeLists.txt +++ b/examples/align-advanced/CMakeLists.txt @@ -7,7 +7,8 @@ project( rs-align-advanced ) if( BUILD_GRAPHICAL_EXAMPLES ) add_executable( ${PROJECT_NAME} rs-align-advanced.cpp - ../../third-party/imgui/imgui.cpp ../../third-party/imgui/imgui_draw.cpp ../../third-party/imgui/imgui_impl_glfw.cpp + ../../third-party/imgui/imgui.cpp ../../third-party/imgui/imgui_draw.cpp ../../third-party/imgui/imgui_impl_glfw.cpp + ../../third-party/imgui/realsense_imgui.cpp ../../third-party/imgui/imgui_impl_opengl3.cpp ../../third-party/imgui/imgui_widgets.cpp ../../third-party/imgui/imgui_tables.cpp ) set_property( TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11 ) target_link_libraries( ${PROJECT_NAME} ${DEPENDENCIES} ) diff --git a/examples/align-advanced/rs-align-advanced.cpp b/examples/align-advanced/rs-align-advanced.cpp index c8168287f5d..bf367bfec9c 100644 --- a/examples/align-advanced/rs-align-advanced.cpp +++ b/examples/align-advanced/rs-align-advanced.cpp @@ -10,6 +10,9 @@ #include #include #include +#include "imgui_impl_glfw.h" +#include +#include void render_slider(rect location, float& clipping_dist); void remove_background(rs2::video_frame& other, const rs2::depth_frame& depth_frame, float depth_scale, float clipping_dist); @@ -24,7 +27,11 @@ int main(int argc, char * argv[]) try // Create and initialize GUI related objects window app(1280, 720, "RealSense Align (Advanced) Example"); // Simple window handling - ImGui_ImplGlfw_Init(app, false); // ImGui library intializition + // Setup Dear ImGui context + ImGui::CreateContext(); + // Setup Platform/Renderer backends + ImGui_ImplGlfw_InitForOpenGL(app, true); + ImGui_ImplOpenGL3_Init(); rs2::colorizer c; // Helper to colorize depth images texture renderer; // Helper for renderig images @@ -109,11 +116,18 @@ int main(int argc, char * argv[]) try renderer.show(pip_stream); // Using ImGui library to provide a slide controller to select the depth clipping distance - ImGui_ImplGlfw_NewFrame(1); + ImGui_ImplOpenGL3_NewFrame(); + ImGui_ImplGlfw_NewFrame(); + ImGui::NewFrame(); render_slider({ 5.f, 0, w, h }, depth_clipping_distance); ImGui::Render(); + ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData()); } + // Cleanup + ImGui_ImplOpenGL3_Shutdown(); + ImGui_ImplGlfw_Shutdown(); + ImGui::DestroyContext(); return EXIT_SUCCESS; } catch (const rs2::error & e) @@ -158,11 +172,11 @@ void render_slider(rect location, float& clipping_dist) //Render the vertical slider ImGui::Begin("slider", nullptr, flags); - ImGui::PushStyleColor(ImGuiCol_FrameBg, ImColor(215.f / 255, 215.0f / 255, 215.0f / 255)); - ImGui::PushStyleColor(ImGuiCol_SliderGrab, ImColor(215.f / 255, 215.0f / 255, 215.0f / 255)); - ImGui::PushStyleColor(ImGuiCol_SliderGrabActive, ImColor(215.f / 255, 215.0f / 255, 215.0f / 255)); + ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(0.2f, 0.3f, 0.7f, 1.0f)); + ImGui::PushStyleColor(ImGuiCol_SliderGrab, { 215.f / 255, 215.0f / 255, 215.0f / 255,1 }); + ImGui::PushStyleColor(ImGuiCol_SliderGrabActive, { 215.f / 255, 215.0f / 255, 215.0f / 255,1 }); auto slider_size = ImVec2(slider_window_width / 2, location.h - (pixels_to_buttom_of_stream_text * 2) - 20); - ImGui::VSliderFloat("", slider_size, &clipping_dist, 0.0f, 6.0f, "", 1.0f, true); + ImGui::VSliderFloat("##vslider", slider_size, &clipping_dist, 0.0f, 6.0f," % .2f"); if (ImGui::IsItemHovered()) ImGui::SetTooltip("Depth Clipping Distance: %.3f", clipping_dist); ImGui::PopStyleColor(3); diff --git a/examples/align-gl/CMakeLists.txt b/examples/align-gl/CMakeLists.txt index 2a0fddb2c79..b228b749cbe 100644 --- a/examples/align-gl/CMakeLists.txt +++ b/examples/align-gl/CMakeLists.txt @@ -10,7 +10,8 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS 1) if(BUILD_GRAPHICAL_EXAMPLES AND NOT APPLE) add_executable( ${PROJECT_NAME} rs-align-gl.cpp - ../../third-party/imgui/imgui.cpp ../../third-party/imgui/imgui_draw.cpp ../../third-party/imgui/imgui_impl_glfw.cpp + ../../third-party/imgui/imgui.cpp ../../third-party/imgui/imgui_draw.cpp ../../third-party/imgui/imgui_impl_glfw.cpp + ../../third-party/imgui/realsense_imgui.cpp ../../third-party/imgui/imgui_impl_opengl3.cpp ../../third-party/imgui/imgui_widgets.cpp ../../third-party/imgui/imgui_tables.cpp ) set_property( TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11 ) target_link_libraries( ${PROJECT_NAME} ${DEPENDENCIES} realsense2-gl ) diff --git a/examples/align-gl/rs-align-gl.cpp b/examples/align-gl/rs-align-gl.cpp index c6e5007c720..0163adfb995 100644 --- a/examples/align-gl/rs-align-gl.cpp +++ b/examples/align-gl/rs-align-gl.cpp @@ -4,8 +4,9 @@ #include #include "example-imgui.hpp" #include // Include GPU-Processing API -#include - +#include "imgui_impl_glfw.h" +#include +#include /* This example introduces the concept of spatial stream alignment. @@ -50,7 +51,11 @@ int main(int argc, char * argv[]) try // Create and initialize GUI related objects window app(1280, 720, "RealSense Align Example"); // Simple window handling - ImGui_ImplGlfw_Init(app, false); // ImGui library intializition + // Setup Dear ImGui context + ImGui::CreateContext(); + // Setup Platform/Renderer backends + ImGui_ImplGlfw_InitForOpenGL(app, true); + ImGui_ImplOpenGL3_Init(); // Once we have a window, initialize GL module // Pass our window to enable sharing of textures between processed frames and the window @@ -124,11 +129,17 @@ int main(int argc, char * argv[]) try glDisable(GL_BLEND); // Render the UI: - ImGui_ImplGlfw_NewFrame(1); + ImGui_ImplOpenGL3_NewFrame(); + ImGui_ImplGlfw_NewFrame(); + ImGui::NewFrame(); render_slider({ 15.f, app.height() - 60, app.width() - 30, app.height() }, &alpha, &dir); ImGui::Render(); + ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData()); } - + // Cleanup + ImGui_ImplOpenGL3_Shutdown(); + ImGui_ImplGlfw_Shutdown(); + ImGui::DestroyContext(); return EXIT_SUCCESS; } catch (const rs2::error & e) diff --git a/examples/align/CMakeLists.txt b/examples/align/CMakeLists.txt index b63f5bd90c6..ca17db53f7a 100644 --- a/examples/align/CMakeLists.txt +++ b/examples/align/CMakeLists.txt @@ -6,7 +6,8 @@ project( rs-align ) if(BUILD_GRAPHICAL_EXAMPLES) -add_executable( ${PROJECT_NAME} rs-align.cpp ../../third-party/imgui/imgui.cpp ../../third-party/imgui/imgui_draw.cpp ../../third-party/imgui/imgui_impl_glfw.cpp) +add_executable( ${PROJECT_NAME} rs-align.cpp ../../third-party/imgui/imgui.cpp ../../third-party/imgui/imgui_draw.cpp ../../third-party/imgui/imgui_impl_glfw.cpp +../../third-party/imgui/realsense_imgui.cpp ../../third-party/imgui/imgui_impl_opengl3.cpp ../../third-party/imgui/imgui_widgets.cpp ../../third-party/imgui/imgui_tables.cpp) set_property( TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11 ) target_link_libraries( ${PROJECT_NAME} ${DEPENDENCIES} ) include_directories( ../../third-party/imgui ../../examples ) diff --git a/examples/align/rs-align.cpp b/examples/align/rs-align.cpp index 8074aec955a..f35b9b45088 100644 --- a/examples/align/rs-align.cpp +++ b/examples/align/rs-align.cpp @@ -5,6 +5,10 @@ #include "example-imgui.hpp" #include +#include "imgui_impl_glfw.h" +#include +#include + /* This example introduces the concept of spatial stream alignment. For example usecase of alignment, please check out align-advanced and measure demos. @@ -44,7 +48,11 @@ int main(int argc, char * argv[]) try // Create and initialize GUI related objects window app(1280, 720, "RealSense Align Example"); // Simple window handling - ImGui_ImplGlfw_Init(app, false); // ImGui library intializition + // Setup Dear ImGui context + ImGui::CreateContext(); + // Setup Platform/Renderer backends + ImGui_ImplGlfw_InitForOpenGL(app, true); + ImGui_ImplOpenGL3_Init(); rs2::colorizer c; // Helper to colorize depth images texture depth_image, color_image; // Helpers for renderig images @@ -111,11 +119,17 @@ int main(int argc, char * argv[]) try glDisable(GL_BLEND); // Render the UI: - ImGui_ImplGlfw_NewFrame(1); + ImGui_ImplOpenGL3_NewFrame(); + ImGui_ImplGlfw_NewFrame(); + ImGui::NewFrame(); render_slider({ 15.f, app.height() - 60, app.width() - 30, app.height() }, &alpha, &dir); ImGui::Render(); + ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData()); } - + // Cleanup + ImGui_ImplOpenGL3_Shutdown(); + ImGui_ImplGlfw_Shutdown(); + ImGui::DestroyContext(); return EXIT_SUCCESS; } catch (const rs2::error & e) diff --git a/examples/example-imgui.hpp b/examples/example-imgui.hpp index 2083f400e0b..ce41ff4c82f 100644 --- a/examples/example-imgui.hpp +++ b/examples/example-imgui.hpp @@ -50,7 +50,7 @@ class hdr_slider : public slider { ImGui::Begin(name_id.c_str(), nullptr, _sliders_flags); ImGui::Text("%s",_name); bool is_changed = - ImGui::SliderFloat("", &_value, _min_value, _max_value, "%.3f", 5.0f, false); //5.0f for logarithmic scale + ImGui::SliderFloat("Slider Label", &_value, _min_value, _max_value, "%.3f", ImGuiSliderFlags_Logarithmic); //5.0f for logarithmic scale if (is_changed) { _sensor.set_option(RS2_OPTION_SEQUENCE_ID, float(_seq_id)); _sensor.set_option(_option, _value); @@ -146,7 +146,7 @@ class hdr_widgets { void render_widgets() { //start a new frame of ImGui - ImGui_ImplGlfw_NewFrame(1); + ImGui_ImplGlfw_NewFrame(); _exposure_slider_seq_2.show(); _exposure_slider_seq_1.show(); diff --git a/examples/hdr/CMakeLists.txt b/examples/hdr/CMakeLists.txt index 0407b3dc7a4..846ed0faf8f 100644 --- a/examples/hdr/CMakeLists.txt +++ b/examples/hdr/CMakeLists.txt @@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 3.8) project(RealsenseExamplesHdr) if(BUILD_GRAPHICAL_EXAMPLES) - add_executable(rs-hdr rs-hdr.cpp ../example.hpp ../../third-party/imgui/imgui.cpp ../../third-party/imgui/imgui_draw.cpp ../../third-party/imgui/imgui_impl_glfw.cpp) + add_executable(rs-hdr rs-hdr.cpp ../example.hpp ../../third-party/imgui/imgui.cpp ../../third-party/imgui/imgui_draw.cpp ../../third-party/imgui/imgui_impl_glfw.cpp ../../third-party/imgui/realsense_imgui.cpp ../../third-party/imgui/imgui_impl_opengl3.cpp ../../third-party/imgui/imgui_widgets.cpp ../../third-party/imgui/imgui_tables.cpp) set_property(TARGET rs-hdr PROPERTY CXX_STANDARD 11) target_link_libraries( rs-hdr ${DEPENDENCIES} tclap ) include_directories(../ ../../third-party/imgui ../../third-party/glfw/include) diff --git a/examples/hdr/rs-hdr.cpp b/examples/hdr/rs-hdr.cpp index f20f6b854b1..f5feae61f61 100644 --- a/examples/hdr/rs-hdr.cpp +++ b/examples/hdr/rs-hdr.cpp @@ -5,6 +5,9 @@ #include "example-imgui.hpp" // Include short list of convenience functions for rendering #include +#include "imgui_impl_glfw.h" +#include +#include // HDR Example demonstrates how to use the HDR feature - only for D400 product line devices int main() try @@ -103,8 +106,11 @@ int main() try // init view window window app(width, height, title.c_str(), tiles_in_row, tiles_in_col); - // init ImGui with app (window object) - ImGui_ImplGlfw_Init(app, false); + // Setup Dear ImGui context + ImGui::CreateContext(); + // Setup Platform/Renderer backends + ImGui_ImplGlfw_InitForOpenGL(app, true); + ImGui_ImplOpenGL3_Init(); // init hdr_widgets object // hdr_widgets holds the sliders, the text boxes and the frames_map @@ -112,6 +118,7 @@ int main() try while (app) // application is still alive { + data = pipe.wait_for_frames(); // Wait for next set of frames from the camera auto frame = data.get_depth_frame(); @@ -143,15 +150,21 @@ int main() try //update frames in frames map in hdr_widgets hdr_widgets.update_frames_map(infrared_frame, depth_frame, hdr_frame, hdr_seq_id, hdr_seq_size); - + ImGui_ImplOpenGL3_NewFrame(); + ImGui_ImplGlfw_NewFrame(); + ImGui::NewFrame(); //render hdr widgets sliders and text boxes hdr_widgets.render_widgets(); //the show method, when applied on frame map, break it to frames and upload each frame into its specific tile app.show(hdr_widgets.get_frames_map()); - + ImGui::Render(); + ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData()); } - + // Cleanup + ImGui_ImplOpenGL3_Shutdown(); + ImGui_ImplGlfw_Shutdown(); + ImGui::DestroyContext(); return EXIT_SUCCESS; } catch (const rs2::error& e) diff --git a/examples/post-processing/CMakeLists.txt b/examples/post-processing/CMakeLists.txt index 46c405f232b..aff5e085186 100644 --- a/examples/post-processing/CMakeLists.txt +++ b/examples/post-processing/CMakeLists.txt @@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 3.8) project(RealsenseExamplesPost-Processing) if(BUILD_GRAPHICAL_EXAMPLES) - add_executable(rs-post-processing rs-post-processing.cpp ../example.hpp ../../third-party/imgui/imgui.cpp ../../third-party/imgui/imgui_draw.cpp ../../third-party/imgui/imgui_impl_glfw.cpp) + add_executable(rs-post-processing rs-post-processing.cpp ../example.hpp ../../third-party/imgui/imgui.cpp ../../third-party/imgui/imgui_draw.cpp ../../third-party/imgui/imgui_impl_glfw.cpp ../../third-party/imgui/realsense_imgui.cpp ../../third-party/imgui/imgui_impl_opengl3.cpp ../../third-party/imgui/imgui_widgets.cpp ../../third-party/imgui/imgui_tables.cpp) set_property(TARGET rs-post-processing PROPERTY CXX_STANDARD 11) target_link_libraries( rs-post-processing ${DEPENDENCIES} tclap ) include_directories(../ ../../third-party/imgui) diff --git a/examples/post-processing/rs-post-processing.cpp b/examples/post-processing/rs-post-processing.cpp index 96355e7ef1c..da66acb50e3 100644 --- a/examples/post-processing/rs-post-processing.cpp +++ b/examples/post-processing/rs-post-processing.cpp @@ -11,6 +11,9 @@ #include #include "imgui_impl_glfw.h" +#include +#include + /** Helper class for controlling the filter's GUI element @@ -51,7 +54,11 @@ int main(int argc, char * argv[]) try { // Create a simple OpenGL window for rendering: window app(1280, 720, "RealSense Post Processing Example"); - ImGui_ImplGlfw_Init(app, false); + // Setup Dear ImGui context + ImGui::CreateContext(); + // Setup Platform/Renderer backends + ImGui_ImplGlfw_InitForOpenGL(app, true); + ImGui_ImplOpenGL3_Init(); // Construct objects to manage view state glfw_state original_view_orientation{}; @@ -215,7 +222,10 @@ int main(int argc, char * argv[]) try // (Not the safest way to join a thread, please wrap your threads in some RAII manner) stopped = true; processing_thread.join(); - + // Cleanup + ImGui_ImplOpenGL3_Shutdown(); + ImGui_ImplGlfw_Shutdown(); + ImGui::DestroyContext(); return EXIT_SUCCESS; } catch (const rs2::error & e) @@ -251,7 +261,9 @@ void render_ui(float w, float h, std::vector& filters) | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove; - ImGui_ImplGlfw_NewFrame(1); + ImGui_ImplOpenGL3_NewFrame(); + ImGui_ImplGlfw_NewFrame(); + ImGui::NewFrame(); ImGui::SetNextWindowSize({ w, h }); ImGui::Begin("app", nullptr, flags); @@ -288,6 +300,7 @@ void render_ui(float w, float h, std::vector& filters) ImGui::End(); ImGui::Render(); + ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData()); } bool filter_slider_ui::render(const float3& location, bool enabled) diff --git a/examples/record-playback/CMakeLists.txt b/examples/record-playback/CMakeLists.txt index 36865ca4260..9fb4ade7135 100644 --- a/examples/record-playback/CMakeLists.txt +++ b/examples/record-playback/CMakeLists.txt @@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 3.8) project(RealsenseExamplesRecord-Playback) if(BUILD_GRAPHICAL_EXAMPLES) - add_executable(rs-record-playback rs-record-playback.cpp ../example.hpp ../../third-party/imgui/imgui.cpp ../../third-party/imgui/imgui_draw.cpp ../../third-party/imgui/imgui_impl_glfw.cpp) + add_executable(rs-record-playback rs-record-playback.cpp ../example.hpp ../../third-party/imgui/imgui.cpp ../../third-party/imgui/imgui_draw.cpp ../../third-party/imgui/imgui_impl_glfw.cpp ../../third-party/imgui/realsense_imgui.cpp ../../third-party/imgui/imgui_impl_opengl3.cpp ../../third-party/imgui/imgui_widgets.cpp ../../third-party/imgui/imgui_tables.cpp) set_property(TARGET rs-record-playback PROPERTY CXX_STANDARD 11) target_link_libraries( rs-record-playback ${DEPENDENCIES} tclap ) include_directories(../ ../../third-party/imgui) diff --git a/examples/record-playback/rs-record-playback.cpp b/examples/record-playback/rs-record-playback.cpp index 7736fad1aba..314de96e18c 100644 --- a/examples/record-playback/rs-record-playback.cpp +++ b/examples/record-playback/rs-record-playback.cpp @@ -7,6 +7,9 @@ #include #include "imgui_impl_glfw.h" +#include "imgui_impl_glfw.h" +#include +#include // Includes for time display #include @@ -23,7 +26,11 @@ int main(int argc, char * argv[]) try { // Create a simple OpenGL window for rendering: window app(1280, 720, "RealSense Record and Playback Example"); - ImGui_ImplGlfw_Init(app, false); + // Setup Dear ImGui context + ImGui::CreateContext(); + // Setup Platform/Renderer backends + ImGui_ImplGlfw_InitForOpenGL(app, true); + ImGui_ImplOpenGL3_Init(); // Create booleans to control GUI (recorded - allow play button, recording - show 'recording to file' text) bool recorded = false; @@ -61,7 +68,9 @@ int main(int argc, char * argv[]) try | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove; - ImGui_ImplGlfw_NewFrame(1); + ImGui_ImplOpenGL3_NewFrame(); + ImGui_ImplGlfw_NewFrame(); + ImGui::NewFrame(); ImGui::SetNextWindowSize({ app.width(), app.height() }); ImGui::Begin("app", nullptr, flags); @@ -192,10 +201,15 @@ int main(int argc, char * argv[]) try ImGui::End(); ImGui::Render(); + ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData()); // Render depth frames from the default configuration, the recorder or the playback depth_image.render(depth, { app.width() * 0.25f, app.height() * 0.25f, app.width() * 0.5f, app.height() * 0.75f }); } + // Cleanup + ImGui_ImplOpenGL3_Shutdown(); + ImGui_ImplGlfw_Shutdown(); + ImGui::DestroyContext(); return EXIT_SUCCESS; } catch (const rs2::error & e) diff --git a/tools/depth-quality/CMakeLists.txt b/tools/depth-quality/CMakeLists.txt index 82c9678d41f..e89a1a1b313 100644 --- a/tools/depth-quality/CMakeLists.txt +++ b/tools/depth-quality/CMakeLists.txt @@ -37,6 +37,10 @@ if(BUILD_GRAPHICAL_EXAMPLES) ../../third-party/imgui/imgui.cpp ../../third-party/imgui/imgui_draw.cpp ../../third-party/imgui/imgui_impl_glfw.cpp + ../../third-party/imgui/imgui_impl_opengl3.cpp + ../../third-party/imgui/imgui_widgets.cpp + ../../third-party/imgui/imgui_tables.cpp + ../../third-party/imgui/realsense_imgui.cpp ../../third-party/imgui/imgui-fonts-karla.hpp ../../third-party/imgui/imgui-fonts-fontawesome.hpp ../../third-party/glad/glad.c @@ -64,6 +68,7 @@ if(BUILD_GRAPHICAL_EXAMPLES) ../../third-party/imgui/imgui.cpp ../../third-party/imgui/imgui_draw.cpp ../../third-party/imgui/imgui_impl_glfw.cpp + ../../third-party/imgui/imgui_impl_opengl3.cpp ../../third-party/imgui/imgui-fonts-karla.hpp ../../third-party/imgui/imgui-fonts-fontawesome.hpp) diff --git a/tools/depth-quality/depth-quality-model.cpp b/tools/depth-quality/depth-quality-model.cpp index db65524c1ba..cbb46ee730c 100644 --- a/tools/depth-quality/depth-quality-model.cpp +++ b/tools/depth-quality/depth-quality-model.cpp @@ -477,7 +477,7 @@ namespace rs2 // Creating window menus // ********************* ImGui::Begin("Control Panel", nullptr, viewer_ui_traits::imgui_flags | ImGuiWindowFlags_AlwaysVerticalScrollbar); - ImGui::SetContentRegionWidth(_viewer_model.panel_width - 26); + ImGui::SetNextWindowSize({ _viewer_model.panel_width - 26,_viewer_model.panel_y }); if (_device_model.get()) { @@ -512,7 +512,7 @@ namespace rs2 { update_configuration(); } - ImGui::SetContentRegionWidth(windows_width); + ImGui::SetNextWindowSize(ImVec2(windows_width, ImGui::GetContentRegionMax().y)); auto pos = ImGui::GetCursorScreenPos(); for (auto&& lambda : draw_later) diff --git a/tools/rosbag-inspector/CMakeLists.txt b/tools/rosbag-inspector/CMakeLists.txt index 4532b873e30..9cb831c2542 100644 --- a/tools/rosbag-inspector/CMakeLists.txt +++ b/tools/rosbag-inspector/CMakeLists.txt @@ -18,6 +18,10 @@ if(BUILD_GRAPHICAL_EXAMPLES) ../../third-party/imgui/imgui.cpp ../../third-party/imgui/imgui_draw.cpp ../../third-party/imgui/imgui_impl_glfw.cpp + ../../third-party/imgui/imgui_impl_opengl3.cpp + ../../third-party/imgui/imgui_widgets.cpp + ../../third-party/imgui/imgui_tables.cpp + ../../third-party/imgui/realsense_imgui.cpp ../../third-party/imgui/imgui-fonts-karla.hpp ../../third-party/imgui/imgui-fonts-fontawesome.hpp ../../third-party/tinyfiledialogs/tinyfiledialogs.c diff --git a/tools/rosbag-inspector/rs-rosbag-inspector.cpp b/tools/rosbag-inspector/rs-rosbag-inspector.cpp index 584bebf97a6..0550ebbe789 100644 --- a/tools/rosbag-inspector/rs-rosbag-inspector.cpp +++ b/tools/rosbag-inspector/rs-rosbag-inspector.cpp @@ -25,6 +25,7 @@ #include #include #include +#include "imgui_impl_opengl3.h" #include #ifdef _MSC_VER #ifndef NOMINMAX @@ -59,6 +60,7 @@ class gui_window if (!_first_frame) { ImGui::Render(); + ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData()); glfwSwapBuffers(_window); } bool res = !glfwWindowShouldClose(_window); @@ -67,7 +69,9 @@ class gui_window glfwGetWindowSize(_window, &_w, &_h); glMatrixMode(GL_PROJECTION); glLoadIdentity(); - ImGui_ImplGlfw_NewFrame(1); + ImGui_ImplOpenGL3_NewFrame(); + ImGui_ImplGlfw_NewFrame(); + ImGui::NewFrame(); _first_frame = false; return res; } @@ -96,7 +100,9 @@ class gui_window f->AddFiles(std::vector(paths, paths + count)); }); - ImGui_ImplGlfw_Init(_window, true); + ImGui::CreateContext(); + ImGui_ImplGlfw_InitForOpenGL(_window, true); + ImGui_ImplOpenGL3_Init(); glfwSetScrollCallback(_window, [](GLFWwindow * w, double xoffset, double yoffset) { @@ -414,7 +420,7 @@ int main(int argc, const char** argv) try int flags = ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoSavedSettings; static bool open = true; - ImGui::SetNextWindowSize({ float(window.width()), float(window.height()) }, flags | ImGuiSetCond_FirstUseEver); + ImGui::SetNextWindowSize({ float(window.width()), float(window.height()) }, ImGuiCond_FirstUseEver); if (ImGui::Begin("Rosbag Inspector", nullptr, flags | ImGuiWindowFlags_MenuBar)) { draw_menu_bar(); @@ -432,8 +438,10 @@ int main(int argc, const char** argv) try ImGui::PopStyleColor(10); std::this_thread::sleep_for(std::chrono::milliseconds(10)); } - + // Cleanup + ImGui_ImplOpenGL3_Shutdown(); ImGui_ImplGlfw_Shutdown(); + ImGui::DestroyContext(); glfwTerminate(); return 0; }