Fix viewport & window issues (#2630)

* Add support for multiple windows & viewports
With correct rendering of both Scene and Overlays/GUI.
GUI is restricted to either the first window or any other windows tagged
with "GUI", overlays are drawn on all windows/viewports.

Closes #2542 and #1645
This commit is contained in:
Joakim Kilby
2023-05-17 22:02:47 +02:00
committed by GitHub
parent f613b6651d
commit ca4b6d2ce2
9 changed files with 112 additions and 37 deletions

View File

@@ -89,6 +89,7 @@ public:
void deinitializeGL();
void preSynchronization();
void postSynchronizationPreDraw();
void viewportChanged();
void render(const glm::mat4& sceneMatrix, const glm::mat4& viewMatrix,
const glm::mat4& projectionMatrix);
void drawOverlays();

View File

@@ -62,8 +62,14 @@ struct WindowDelegate {
glm::ivec2 (*currentViewportSize)() = []() { return glm::ivec2(0); };
glm::ivec2(*currentViewportResolution)() = []() { return glm::ivec2(0); };
glm::vec2 (*dpiScaling)() = []() { return glm::vec2(1.f); };
glm::ivec2(*firstWindowResolution)() = []() { return glm::ivec2(0); };
glm::ivec2(*guiWindowResolution)() = []() { return glm::ivec2(0); };
float (*osDpiScaling)() = []() { return 1.f; };
bool (*hasGuiWindow)() = []() { return false; };
@@ -89,6 +95,8 @@ struct WindowDelegate {
int (*currentWindowId)() = []() { return 0; };
int (*firstWindowId)() = []() { return 0; };
double (*getHorizFieldOfView)() = []() { return 0.0; };
void (*setHorizFieldOfView)(float hFovDeg) = [](float) { };
@@ -113,6 +121,9 @@ struct WindowDelegate {
int (*numberOfNodes)() = []() { return 0; };
int (*currentNode)() = []() { return 0; };
glm::vec2 (*mousePositionViewportRelative)(glm::vec2 mousePosition) =
[](glm::vec2) { return glm::vec2(0); };
};
} // namespace openspace