openFrameworks
openFrameworks copied to clipboard
ofAppGLFWWindow - Incorrect value for pixelScreenCoordScale when minimizing window
When ofAppGLFWWindow is minimized, a call to ofAppGLFWWindow::resize_cb() is made while window and framebuffer width/height are 0.
Therefore, the code updates pixelScreenCoordScale with an invalid value (division by 0) :
void ofAppGLFWWindow::resize_cb(GLFWwindow* windowP_, int w, int h) {
ofAppGLFWWindow * instance = setCurrent(windowP_);
// Detect if the window is running in a retina mode
int framebufferW, framebufferH; // <- physical pixel extents
glfwGetFramebufferSize(windowP_, &framebufferW, &framebufferH);
int windowW, windowH; // <- screen coordinates, which may be scaled
glfwGetWindowSize(windowP_, &windowW, &windowH);
// Find scale factor needed to transform from screen coordinates
// to physical pixel coordinates
instance->pixelScreenCoordScale = (float)framebufferW / (float)windowW; // <----- Division by zero
Calls to ofGetWidth() and ofGetHeight() in ofApp::Draw()/ofApp::Update() then returns invalid values since they scale according to pixelScreenCoordScale .
any specific platform? all platforms? thanks
I had the problem on Windows 10.