nmwsharp / nmwsharp/polyscope

Feature Request: Ability to render Polyscope viewer in multiple ImGui windows

Abierto
#231 2 comentarios 3 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Lenguaje dominante
C++
Estrellas
2.2k
Forks
242
Merge medio
11 min
PR fusionados (30 d)
1

Descripción

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;
}

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza con el ejemplo de ImGui, GLFW y OpenGL3 de main.cpp incluido en el issue y, después, inspecciona cómo Polyscope gestiona actualmente su ventana y su bucle de eventos. Determina los puntos de entrada arquitectónicos necesarios para renderizar visualizaciones independientes en múltiples ventanas de ImGui; se considera terminado cuando la API de renderizado multi-ventana solicitada funciona dentro de una sola GUI.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
cpp
Área
computer-graphics, desktop
Tipo de issue
Nueva funcionalidad
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Estancado
Claridad
Necesita aclaración
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.