Skip to content

Commit 07fd391

Browse files
committed
disable GLFW_SCALE_TO_MONITOR
1 parent 799cc67 commit 07fd391

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

src/render/opengl/gl_engine_glfw.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,13 @@ void GLEngineGLFW::initialize() {
5151
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
5252
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
5353

54-
// this is required to make sure the initial windows size is appropriate
55-
glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE);
54+
// This tells GLFW to scale window size/positioning/content based on the system-reported DPI scaling factor
55+
// However, it can lead to some confusing behaviors, for instance, on linux with scaling=200%, if the user
56+
// sets view::windowWidth = 1280, they might get back a window with windowWidth == bufferWidth == 2560,
57+
// which is quite confusing.
58+
// For this reason we _do not_ set this hint. If desired, the user can specify a windowWidth = 1280*uiScale,
59+
// or let the window size by loaded from .polyscope.ini after setting manually once.
60+
// glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE);
5661

5762
#if __APPLE__
5863
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
@@ -74,6 +79,10 @@ void GLEngineGLFW::initialize() {
7479
view::windowWidth = newWindowWidth;
7580
view::windowHeight = newWindowHeight;
7681

82+
std::cout << "created window with: \n";
83+
std::cout << " bufferWidth: " << view::bufferWidth << " bufferHeight: " << view::bufferHeight << "\n";
84+
std::cout << " windowWidth: " << view::windowWidth << " windowHeight: " << view::windowHeight << "\n";
85+
7786
setWindowResizable(view::windowResizable);
7887

7988
// Set the UI scale to account for system-requested DPI scaling

0 commit comments

Comments
 (0)