Skip to content

Commit

Permalink
Merge pull request #77 from hotstreams/fix/ctx-win-size
Browse files Browse the repository at this point in the history
set actual framebuffer size after context window creation
  • Loading branch information
hotstreams authored Nov 26, 2024
2 parents ff7043c + f8e05c6 commit 96fb53a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/limitless/core/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ using namespace Limitless;

Context::Context(
const std::string& title,
glm::uvec2 size,
glm::uvec2 _size,
const Context* shared,
const WindowHints& hints
) : ContextInitializer()
, ContextState()
, size {size} {
, size {_size} {
// sets window hints for creation
for (const auto& [hint, value] : hints) {
glfwWindowHint(static_cast<int>(hint), value);
Expand All @@ -23,6 +23,13 @@ Context::Context(
throw context_error {"Failed to create window"};
}

// The created window, framebuffer and context may differ from what you requested.
int framebuffer_width = 0;
int framebuffer_height = 0;
glfwGetFramebufferSize(window, &framebuffer_width, &framebuffer_height);

size = glm::uvec2(framebuffer_width, framebuffer_height);

if (!glew_inited) {
makeCurrent();
initializeGLEW();
Expand Down

0 comments on commit 96fb53a

Please sign in to comment.