Skip to content

Commit

Permalink
add libdl for linux OpenGL3
Browse files Browse the repository at this point in the history
  • Loading branch information
Noy-Zini committed Nov 26, 2024
1 parent 54a0dc3 commit 4ed121d
Show file tree
Hide file tree
Showing 19 changed files with 92 additions and 99 deletions.
6 changes: 3 additions & 3 deletions common/device-model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2001,7 +2001,7 @@ namespace rs2

try
{
if (ImGui::CustomComboBox(opt_model.id.c_str(), &selected, labels.data(),
if (RsImGui::CustomComboBox(opt_model.id.c_str(), &selected, labels.data(),
static_cast<int>(labels.size())))
{
*opt_model.invalidate_flag = true;
Expand Down Expand Up @@ -2897,7 +2897,7 @@ namespace rs2
ImGui::PushStyleColor(ImGuiCol_Text, white);
ImGui::PushStyleColor(ImGuiCol_PopupBg, dark_window_background);
label = rsutils::string::from() << "Enable " << pb->get_name() << " post-processing filter";
ImGui::SetTooltip(label.c_str());
ImGui::SetTooltip("%s",label.c_str());
window.link_hovered();
ImGui::PopStyleColor(2);
}
Expand All @@ -2922,7 +2922,7 @@ namespace rs2
ImGui::PushStyleColor(ImGuiCol_PopupBg, dark_window_background);
label = rsutils::string::from()
<< "Disable " << pb->get_name() << " post-processing filter";
ImGui::SetTooltip(label.c_str());
ImGui::SetTooltip("%s",label.c_str());
window.link_hovered();
ImGui::PopStyleColor(2);
}
Expand Down
4 changes: 2 additions & 2 deletions common/option-model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ bool option_model::draw_combobox( notifications_model & model,

try
{
if( ImGui::CustomComboBox( id.c_str(), &selected, labels.data(), static_cast< int >( labels.size() ) ) )
if( RsImGui::CustomComboBox( id.c_str(), &selected, labels.data(), static_cast< int >( labels.size() ) ) )
{
float tmp_value = range.min + range.step * selected;
model.add_log( rsutils::string::from()
Expand Down Expand Up @@ -497,7 +497,7 @@ bool option_model::draw_slider( notifications_model & model,
// runs when changing a value with slider and not the textbox
auto int_value = static_cast< int >( value_as_float() );

if( ImGui::SliderIntWithSteps( id.c_str(),
if( RsImGui::SliderIntWithSteps( id.c_str(),
&int_value,
static_cast< int >( range.min ),
static_cast< int >( range.max ),
Expand Down
2 changes: 1 addition & 1 deletion common/stream-model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ namespace rs2
bool draw_combo_box(const std::string& id, const std::vector<std::string>& device_names, int& new_index)
{
std::vector<const char*> device_names_chars = get_string_pointers(device_names);
return ImGui::CustomComboBox(id.c_str(), &new_index, device_names_chars.data(), static_cast<int>(device_names.size()));
return RsImGui::CustomComboBox(id.c_str(), &new_index, device_names_chars.data(), static_cast<int>(device_names.size()));
}

void stream_model::show_stream_header(ImFont* font, const rect &stream_rect, viewer_model& viewer)
Expand Down
12 changes: 6 additions & 6 deletions common/subdevice-model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ namespace rs2
ImGui::PushItemWidth(-1); // Set the width for the combo box itself
ImGui::PushStyleColor(ImGuiCol_TextSelectedBg, { 1,1,1,1 });
auto tmp_selected_res_id = ui.selected_res_id;
if (ImGui::CustomComboBox(label.c_str(), &tmp_selected_res_id, res_chars.data(),
if (RsImGui::CustomComboBox(label.c_str(), &tmp_selected_res_id, res_chars.data(),
static_cast<int>(res_chars.size())))
{
res = true;
Expand Down Expand Up @@ -641,7 +641,7 @@ namespace rs2
{
ImGui::PushItemWidth(-1); // Set the width for the combo box itself
ImGui::PushStyleColor(ImGuiCol_TextSelectedBg, { 1,1,1,1 });
if (ImGui::CustomComboBox(label.c_str(), &ui.selected_shared_fps_id, fps_chars.data(),
if (RsImGui::CustomComboBox(label.c_str(), &ui.selected_shared_fps_id, fps_chars.data(),
static_cast<int>(fps_chars.size())))
{
res = true;
Expand Down Expand Up @@ -720,7 +720,7 @@ namespace rs2
{
ImGui::PushItemWidth(-1); // Set the width for the combo box itself
ImGui::PushStyleColor(ImGuiCol_TextSelectedBg, { 1,1,1,1 });
ImGui::CustomComboBox(label.c_str(), &ui.selected_format_id[f.first], formats_chars.data(),
RsImGui::CustomComboBox(label.c_str(), &ui.selected_format_id[f.first], formats_chars.data(),
static_cast<int>(formats_chars.size()));
ImGui::PopStyleColor();
ImGui::PopItemWidth();
Expand All @@ -747,7 +747,7 @@ namespace rs2
{
ImGui::PushItemWidth(-1); // Set the width for the combo box itself
ImGui::PushStyleColor(ImGuiCol_TextSelectedBg, { 1,1,1,1 });
ImGui::CustomComboBox(label.c_str(), &ui.selected_fps_id[f.first], fps_chars.data(),
RsImGui::CustomComboBox(label.c_str(), &ui.selected_fps_id[f.first], fps_chars.data(),
static_cast<int>(fps_chars.size()));
ImGui::PopStyleColor();
ImGui::PopItemWidth();
Expand Down Expand Up @@ -803,7 +803,7 @@ namespace rs2
ImGui::PushItemWidth(-1); // Set the width for the combo box itself
ImGui::PushStyleColor(ImGuiCol_TextSelectedBg, { 1,1,1,1 });
auto tmp_selected_res_id = ui.selected_res_id_map[stream_type_id];
if (ImGui::CustomComboBox(label.c_str(), &tmp_selected_res_id, res_chars.data(),
if (RsImGui::CustomComboBox(label.c_str(), &tmp_selected_res_id, res_chars.data(),
static_cast<int>(res_chars.size())))
{
res = true;
Expand Down Expand Up @@ -935,7 +935,7 @@ namespace rs2
{
ImGui::PushItemWidth(-1); // Set the width for the combo box itself
ImGui::PushStyleColor(ImGuiCol_TextSelectedBg, { 1,1,1,1 });
ImGui::CustomComboBox(label.c_str(), &ui.selected_format_id[f.first], formats_chars.data(),
RsImGui::CustomComboBox(label.c_str(), &ui.selected_format_id[f.first], formats_chars.data(),
static_cast<int>(formats_chars.size()));
ImGui::PopStyleColor();
ImGui::PopItemWidth();
Expand Down
2 changes: 1 addition & 1 deletion common/ux-alignment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ bool is_gui_aligned(GLFWwindow *win)

glfwSwapBuffers(win);

ImGui::PushNewFrame();
RsImGui::PushNewFrame();

SetFocus(hwn);

Expand Down
6 changes: 3 additions & 3 deletions common/ux-window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ namespace rs2
if (_use_glsl_proc) rs2::gl::shutdown_processing();

ImGui::GetIO().Fonts->ClearFonts(); // To be refactored into Viewer theme object
ImGui::PopNewFrame();
RsImGui::PopNewFrame();
glfwDestroyWindow(_win);
glfwDestroyCursor(_hand_cursor);
glfwDestroyCursor(_cross_cursor);
Expand Down Expand Up @@ -670,7 +670,7 @@ namespace rs2
}

ImGui::GetIO().Fonts->ClearFonts(); // To be refactored into Viewer theme object
ImGui::PopNewFrame();
RsImGui::PopNewFrame();
glfwDestroyWindow(_win);

glfwDestroyCursor(_hand_cursor);
Expand Down Expand Up @@ -756,7 +756,7 @@ namespace rs2
ImGui::GetIO().MouseWheel = _mouse.ui_wheel;
_mouse.ui_wheel = 0.f;

ImGui::PushNewFrame();
RsImGui::PushNewFrame();
}

void ux_window::begin_viewport()
Expand Down
6 changes: 6 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ else()
list( APPEND DEPENDENCIES log )
endif()
endif()
# Check the platform and conditionally link OpenGL and libdl (for linux)
if(WIN32)
list( APPEND DEPENDENCIES OpenGL::GL)
else()
list( APPEND DEPENDENCIES OpenGL::GL dl)
endif()

# Add all imgui cpp source files and store the list in the IMGUI_SOURCES variable
file(GLOB IMGUI_SOURCES "../third-party/imgui/*.cpp")
Expand Down
6 changes: 3 additions & 3 deletions examples/align-advanced/rs-align-advanced.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,14 @@ 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::PushNewFrame();
RsImGui::PushNewFrame();
render_slider({ 5.f, 0, w, h }, depth_clipping_distance);
ImGui::Render();
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());

}
// Cleanup
ImGui::PopNewFrame();
RsImGui::PopNewFrame();
return EXIT_SUCCESS;
}
catch (const rs2::error & e)
Expand Down Expand Up @@ -172,7 +172,7 @@ void render_slider(rect location, float& clipping_dist)
ImGui::PushStyleColor(ImGuiCol_SliderGrab, ImColor(215.f / 255, 215.0f / 255, 215.0f / 255).Value);
ImGui::PushStyleColor(ImGuiCol_SliderGrabActive, ImColor(215.f / 255, 215.0f / 255, 215.0f / 255).Value);
auto slider_size = ImVec2(slider_window_width / 2, location.h - (pixels_to_buttom_of_stream_text * 2) - 20);
ImGui::VSliderFloat("##vslider", slider_size, &clipping_dist, 0.0f, 6.0f, "", 1.0f, true);
RsImGui::VSliderFloat("##vslider", slider_size, &clipping_dist, 0.0f, 6.0f, "", 1.0f, true);
if (ImGui::IsItemHovered())
ImGui::SetTooltip("Depth Clipping Distance: %.3f", clipping_dist);
ImGui::PopStyleColor(3);
Expand Down
4 changes: 2 additions & 2 deletions examples/align-gl/rs-align-gl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@ int main(int argc, char * argv[]) try
glDisable(GL_BLEND);

// Render the UI:
ImGui::PushNewFrame();
RsImGui::PushNewFrame();
render_slider({ 15.f, app.height() - 60, app.width() - 30, app.height() }, &alpha, &dir);
ImGui::Render();
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
}
ImGui::PopNewFrame();
RsImGui::PopNewFrame();
return EXIT_SUCCESS;
}
catch (const rs2::error & e)
Expand Down
4 changes: 2 additions & 2 deletions examples/align/rs-align.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,12 @@ int main(int argc, char * argv[]) try
glDisable(GL_BLEND);

// Render the UI:
ImGui::PushNewFrame();
RsImGui::PushNewFrame();
render_slider({ 15.f, app.height() - 60, app.width() - 30, app.height() }, &alpha, &dir);
ImGui::Render();
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
}
ImGui::PopNewFrame();
RsImGui::PopNewFrame();
return EXIT_SUCCESS;
}
catch (const rs2::error & e)
Expand Down
4 changes: 2 additions & 2 deletions examples/hdr/rs-hdr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,14 @@ 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::PushNewFrame();
RsImGui::PushNewFrame();
//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::PopNewFrame();
RsImGui::PopNewFrame();
return EXIT_SUCCESS;
}
catch (const rs2::error& e)
Expand Down
6 changes: 3 additions & 3 deletions examples/post-processing/rs-post-processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ 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();
ImGui::PopNewFrame();
RsImGui::PopNewFrame();
return EXIT_SUCCESS;
}
catch (const rs2::error & e)
Expand Down Expand Up @@ -262,7 +262,7 @@ void render_ui(float w, float h, std::vector<filter_options>& filters)
| ImGuiWindowFlags_NoResize
| ImGuiWindowFlags_NoMove;

ImGui::PushNewFrame();
RsImGui::PushNewFrame();
ImGui::SetNextWindowSize({ w, h });
ImGui::GetStyle().Colors[ImGuiCol_FrameBg] = ImVec4(0.2f, 0.2f, 0.2f, 1.0f);
ImGui::GetStyle().Colors[ImGuiCol_FrameBgHovered] = ImVec4(0.3f, 0.3f, 0.3f, 1.0f);
Expand Down Expand Up @@ -331,7 +331,7 @@ bool filter_slider_ui::render(const float3& location, bool enabled)
if (is_int)
{
int value_as_int = static_cast<int>(value);
value_changed = ImGui::SliderIntTofloat(("##" + name).c_str(), &value_as_int, static_cast<int>(range.min), static_cast<int>(range.max), "%.0f");
value_changed = RsImGui::SliderIntTofloat(("##" + name).c_str(), &value_as_int, static_cast<int>(range.min), static_cast<int>(range.max), "%.0f");
if( step > 1 )
{
value_as_int = static_cast< int >( range.min )
Expand Down
4 changes: 2 additions & 2 deletions examples/record-playback/rs-record-playback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ int main(int argc, char * argv[]) try
| ImGuiWindowFlags_NoResize
| ImGuiWindowFlags_NoMove;

ImGui::PushNewFrame();
RsImGui::PushNewFrame();
ImGui::SetNextWindowPos(ImVec2(0, 0));
ImGui::SetNextWindowSize({ app.width(), app.height() });
ImGui::Begin("app", nullptr, flags);
Expand Down Expand Up @@ -206,7 +206,7 @@ int main(int argc, char * argv[]) try
depth_image.render(depth, { app.width() * 0.25f, app.height() * 0.25f, app.width() * 0.5f, app.height() * 0.75f });
}
// Cleanup
ImGui::PopNewFrame();
RsImGui::PopNewFrame();
return EXIT_SUCCESS;
}
catch (const rs2::error & e)
Expand Down
Loading

0 comments on commit 4ed121d

Please sign in to comment.