aboutsummaryrefslogtreecommitdiff
path: root/BuddhaTest
diff options
context:
space:
mode:
authorAndreas Grois <andi@grois.info>2018-03-11 13:15:09 +0100
committerAndreas Grois <andi@grois.info>2018-03-11 13:15:09 +0100
commit71689f4c1c047e6837891667f6ecfd03a9508863 (patch)
tree388b8fb2add17559ff8dbf1fa581e78d58bcbe10 /BuddhaTest
parent6842d96a7ec31d3ec192c715fee45e895ed01a48 (diff)
Make preview window scale if being resized.
Diffstat (limited to 'BuddhaTest')
-rw-r--r--BuddhaTest/src/BuddhaTest.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/BuddhaTest/src/BuddhaTest.cpp b/BuddhaTest/src/BuddhaTest.cpp
index a03e8e8..b9629bf 100644
--- a/BuddhaTest/src/BuddhaTest.cpp
+++ b/BuddhaTest/src/BuddhaTest.cpp
@@ -9,6 +9,11 @@ void error_callback(int error, const char* description)
std::cerr << "Error: " << description << std::endl;
}
+void framebuffer_size_callback(GLFWwindow* window, int width, int height)
+{
+ glViewport(0, 0, width, height);
+}
+
int main(int argc, char * argv[])
{
Helpers::RenderSettings settings;
@@ -41,6 +46,9 @@ int main(int argc, char * argv[])
return -1;
}
+ //register callback on window resize:
+ glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);
+
/* Make the window's context current */
glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc)glfwGetProcAddress);