nmwsharp / nmwsharp/polyscope

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

Ouverte
#231 2 commentaires 3 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Langage dominant
C++
Étoiles
2.2k
Forks
242
Merge moyen
11 min
PR mergées (30 j)
1

Description

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

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par l’exemple ImGui, GLFW et OpenGL3 de main.cpp présent dans l’issue, puis examinez comment Polyscope gère actuellement sa fenêtre et sa boucle d’événements. Déterminez les points d’entrée architecturaux nécessaires pour effectuer le rendu de visualisations distinctes dans plusieurs fenêtres ImGui ; le travail est considéré comme terminé lorsque l’API de rendu multi-fenêtre demandée fonctionne au sein d’une seule GUI.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
cpp
Domaine
computer-graphics, desktop
Type d'issue
Fonctionnalité
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
À l'abandon
Clarté
À clarifier
Accessibilité débutants
25/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.