Skip to content

Commit f8e05c6

Browse files
committed
set actual framebuffer size after context window creation
1 parent ff7043c commit f8e05c6

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

src/limitless/core/context.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ using namespace Limitless;
66

77
Context::Context(
88
const std::string& title,
9-
glm::uvec2 size,
9+
glm::uvec2 _size,
1010
const Context* shared,
1111
const WindowHints& hints
1212
) : ContextInitializer()
1313
, ContextState()
14-
, size {size} {
14+
, size {_size} {
1515
// sets window hints for creation
1616
for (const auto& [hint, value] : hints) {
1717
glfwWindowHint(static_cast<int>(hint), value);
@@ -23,6 +23,13 @@ Context::Context(
2323
throw context_error {"Failed to create window"};
2424
}
2525

26+
// The created window, framebuffer and context may differ from what you requested.
27+
int framebuffer_width = 0;
28+
int framebuffer_height = 0;
29+
glfwGetFramebufferSize(window, &framebuffer_width, &framebuffer_height);
30+
31+
size = glm::uvec2(framebuffer_width, framebuffer_height);
32+
2633
if (!glew_inited) {
2734
makeCurrent();
2835
initializeGLEW();

0 commit comments

Comments
 (0)