Return the correct window size for side-by-side stereo setting (closing #110)

This commit is contained in:
Alexander Bock
2016-10-26 14:44:42 +02:00
parent f9b7953ebf
commit b95c80bb40

View File

@@ -90,19 +90,27 @@ uint32_t SGCTWindowWrapper::mouseButtons(int maxNumber) const {
}
glm::ivec2 SGCTWindowWrapper::currentWindowSize() const {
//return glm::ivec2(sgct::Engine::instance()->getCurrentWindowPtr()->getXResolution(),
// sgct::Engine::instance()->getCurrentWindowPtr()->getYResolution());
return glm::ivec2(sgct::Engine::instance()->getCurrentWindowPtr()->getXResolution(),
sgct::Engine::instance()->getCurrentWindowPtr()->getYResolution());
auto window = sgct::Engine::instance()->getCurrentWindowPtr();
switch (window->getStereoMode()) {
case sgct::SGCTWindow::Side_By_Side_Stereo:
case sgct::SGCTWindow::Side_By_Side_Inverted_Stereo:
return glm::ivec2(
window->getXResolution() / 2,
window->getYResolution());
case sgct::SGCTWindow::Top_Bottom_Stereo:
case sgct::SGCTWindow::Top_Bottom_Inverted_Stereo:
return glm::ivec2(
window->getXResolution(),
window->getYResolution() / 2);
default:
return glm::ivec2(
window->getXResolution(),
window->getYResolution());
}
}
glm::ivec2 SGCTWindowWrapper::currentWindowResolution() const {
//int width, height;
//auto window = sgct::Engine::instance()->getCurrentWindowPtr()->getWindowHandle();
//glfwGetFramebufferSize(window, &width, &height);
//return glm::ivec2(width, height);
auto window = sgct::Engine::instance()->getCurrentWindowPtr();
int x, y;
sgct::Engine::instance()->getCurrentWindowPtr()->getFinalFBODimensions(x, y);
return glm::ivec2(x, y);