Feature Request: Ability to render Polyscope viewer in multiple ImGui windows
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- C++
- Star
- 2.2k
- Fork
- 242
- Merge trung bình
- 11 phút
- Pull request đã merge (30 ngày)
- 1
Mô tả
Hello Polyscope maintainers and community,
I'm using Polyscope to visualize point cloud data within a GUI application.
Currently, Polyscope encapsulates its own window and event loop and doesn't provide an API to render into multiple ImGui windows. In my case, I would like to show the 3D data in one window alongside 2 other windows to show the two 2D cameras windows. Specifically, I'm looking to render different Polyscope visualizations in separate ImGui windows within the same GUI.
I understand that this feature might involve significant changes to Polyscope's architecture, but I believe the added flexibility would benefit many users and use cases. I look forward to hearing your thoughts on this suggestion.
Thank you for your time and the excellent work on Polyscope!
This is the implementation of two different windows in the same GUI using ImGUI, GLFW and OpenGL3:
// main.cpp
#include "imgui.h"
#include "imgui_impl_glfw.h"
#include "imgui_impl_opengl3.h"
#include <GLFW/glfw3.h>
int main() {
// Set up window
glfwInit();
GLFWwindow* window = glfwCreateWindow(1280, 720, "Hello", NULL, NULL);
glfwMakeContextCurrent(window);
glfwSwapInterval(1); // Enable vsync
// Set up Dear ImGui context
IMGUI_CHECKVERSION();
ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO();
// Set up Platform/Renderer bindings
ImGui_ImplGlfw_InitForOpenGL(window, true);
ImGui_ImplOpenGL3_Init("#version 130");
while (!glfwWindowShouldClose(window)) {
glfwPollEvents();
// Start ImGui frame
ImGui_ImplOpenGL3_NewFrame();
ImGui_ImplGlfw_NewFrame();
ImGui::NewFrame();
// Here we construct our GUI
ImGui::SetNextWindowPos(ImVec2(0, 0));
ImGui::SetNextWindowSize(ImVec2(640, 720));
ImGui::Begin("Window 1");
ImGui::Text("This is window 1");
ImGui::End();
ImGui::SetNextWindowPos(ImVec2(640, 0));
ImGui::SetNextWindowSize(ImVec2(640, 720));
ImGui::Begin("Window 2");
ImGui::Text("This is window 2");
ImGui::End();
// Render ImGui frame
ImGui::Render();
int display_w, display_h;
glfwGetFramebufferSize(window, &display_w, &display_h);
glViewport(0, 0, display_w, display_h);
glClearColor(0.45f, 0.55f, 0.60f, 1.00f);
glClear(GL_COLOR_BUFFER_BIT);
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
glfwSwapBuffers(window);
}
// Cleanup
ImGui_ImplOpenGL3_Shutdown();
ImGui_ImplGlfw_Shutdown();
ImGui::DestroyContext();
glfwDestroyWindow(window);
glfwTerminate();
return 0;
}
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với ví dụ ImGui, GLFW và OpenGL3 trong main.cpp ở issue, sau đó kiểm tra cách Polyscope hiện đang quản lý cửa sổ và vòng lặp sự kiện của nó. Xác định các điểm vào kiến trúc cần thiết để render các hình ảnh trực quan riêng biệt trong nhiều cửa sổ ImGui; hoàn tất có nghĩa là API render đa cửa sổ được yêu cầu hoạt động trong một GUI duy nhất.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- cpp
- Lĩnh vực
- computer-graphics, desktop
- Loại issue
- Tính năng
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 25/100