diff --git a/README.md b/README.md index 58f6d3ad..29a2e817 100644 --- a/README.md +++ b/README.md @@ -280,6 +280,8 @@ GLFW. compile time * Added `glfwGetWindowMonitor` for querying the monitor, if any, of the specified window + * Added `glfwGetFramebufferSize` and `glfwSetFramebufferSizeCallback` for + receiving the current size, in pixels, of the framebuffer * Added `glfwSetWindowPosCallback` and `GLFWwindowposfun` for receiving window position events * Added `glfwSetWindowFocusCallback` and `GLFWwindowfocusfun` for receiving @@ -377,6 +379,7 @@ GLFW. * Bugfix: Cursor centering upon leaving captured cursor mode was reported before the mode was changed to non-captured * [Cocoa] Added support for OpenGL 3.2 core profile in 10.7 Lion and above + * [Cocoa] Added support for high-DPI (Retina) monitors * [Cocoa] Added support for joysticks * [Cocoa] Postponed menu creation to first window creation * [Cocoa] Replaced `NSDate` time source with `mach_absolute_time` @@ -413,6 +416,7 @@ GLFW. mode was incorrectly removed * [X11] Bugfix: The window size hints were not updated when calling `glfwSetWindowSize` on a non-resizable window + * [Win32] Added support for high-DPI monitors * [Win32] Changed port to use Unicode mode only * [Win32] Removed explicit support for versions of Windows older than Windows XP diff --git a/examples/boing.c b/examples/boing.c index 102fbdfe..21b3b973 100644 --- a/examples/boing.c +++ b/examples/boing.c @@ -589,13 +589,13 @@ int main( void ) exit( EXIT_FAILURE ); } - glfwSetWindowSizeCallback(window, reshape); + glfwSetFramebufferSizeCallback(window, reshape); glfwSetKeyCallback(window, key_callback); glfwMakeContextCurrent(window); glfwSwapInterval( 1 ); - glfwGetWindowSize(window, &width, &height); + glfwGetFramebufferSize(window, &width, &height); reshape(window, width, height); glfwSetTime( 0.0 ); diff --git a/examples/gears.c b/examples/gears.c index 6a1eec3a..6f31aca2 100644 --- a/examples/gears.c +++ b/examples/gears.c @@ -337,13 +337,13 @@ int main(int argc, char *argv[]) } // Set callback functions - glfwSetWindowSizeCallback(window, reshape); + glfwSetFramebufferSizeCallback(window, reshape); glfwSetKeyCallback(window, key); glfwMakeContextCurrent(window); glfwSwapInterval( 1 ); - glfwGetWindowSize(window, &width, &height); + glfwGetFramebufferSize(window, &width, &height); reshape(window, width, height); // Parse command-line options diff --git a/examples/simple.c b/examples/simple.c index c575b436..9a57c36e 100644 --- a/examples/simple.c +++ b/examples/simple.c @@ -57,7 +57,7 @@ int main(void) float ratio; int width, height; - glfwGetWindowSize(window, &width, &height); + glfwGetFramebufferSize(window, &width, &height); ratio = width / (float) height; glViewport(0, 0, width, height); diff --git a/examples/splitview.c b/examples/splitview.c index 0351af1e..f20ce206 100644 --- a/examples/splitview.c +++ b/examples/splitview.c @@ -354,10 +354,10 @@ static void drawAllViews(void) //======================================================================== -// Window size callback function +// Framebuffer size callback function //======================================================================== -static void windowSizeFun(GLFWwindow* window, int w, int h) +static void framebufferSizeFun(GLFWwindow* window, int w, int h) { width = w; height = h > 0 ? h : 1; @@ -467,7 +467,7 @@ int main(void) } // Set callback functions - glfwSetWindowSizeCallback(window, windowSizeFun); + glfwSetFramebufferSizeCallback(window, framebufferSizeFun); glfwSetWindowRefreshCallback(window, windowRefreshFun); glfwSetCursorPosCallback(window, cursorPosFun); glfwSetMouseButtonCallback(window, mouseButtonFun); @@ -477,8 +477,8 @@ int main(void) glfwMakeContextCurrent(window); glfwSwapInterval(1); - glfwGetWindowSize(window, &width, &height); - windowSizeFun(window, width, height); + glfwGetFramebufferSize(window, &width, &height); + framebufferSizeFun(window, width, height); // Main loop for (;;) diff --git a/examples/wave.c b/examples/wave.c index 12b71cbd..ee7125ef 100644 --- a/examples/wave.c +++ b/examples/wave.c @@ -361,10 +361,10 @@ void scroll_callback(GLFWwindow* window, double x, double y) //======================================================================== -// Callback function for window resize events +// Callback function for framebuffer resize events //======================================================================== -void window_size_callback(GLFWwindow* window, int width, int height) +void framebuffer_size_callback(GLFWwindow* window, int width, int height) { float ratio = 1.f; @@ -404,7 +404,7 @@ int main(int argc, char* argv[]) } glfwSetKeyCallback(window, key_callback); - glfwSetWindowSizeCallback(window, window_size_callback); + glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); glfwSetMouseButtonCallback(window, mouse_button_callback); glfwSetCursorPosCallback(window, cursor_position_callback); glfwSetScrollCallback(window, scroll_callback); @@ -412,8 +412,8 @@ int main(int argc, char* argv[]) glfwMakeContextCurrent(window); glfwSwapInterval(1); - glfwGetWindowSize(window, &width, &height); - window_size_callback(window, width, height); + glfwGetFramebufferSize(window, &width, &height); + framebuffer_size_callback(window, width, height); // Initialize OpenGL init_opengl(); diff --git a/include/GLFW/glfw3.h b/include/GLFW/glfw3.h index 27e9cce3..21f25507 100644 --- a/include/GLFW/glfw3.h +++ b/include/GLFW/glfw3.h @@ -679,6 +679,21 @@ typedef void (* GLFWwindowfocusfun)(GLFWwindow*,int); */ typedef void (* GLFWwindowiconifyfun)(GLFWwindow*,int); +/*! @brief The function signature for framebuffer resize callbacks. + * + * This is the function signature for framebuffer resize callback + * functions. + * + * @param[in] window The window whose framebuffer was resized. + * @param[in] width The new width, in pixels, of the framebuffer. + * @param[in] height The new height, in pixels, of the framebuffer. + * + * @sa glfwSetFramebufferSizeCallback + * + * @ingroup window + */ +typedef void (* GLFWframebuffersizefun)(GLFWwindow*,int,int); + /*! @brief The function signature for mouse button callbacks. * * This is the function signature for mouse button callback functions. @@ -1369,6 +1384,21 @@ GLFWAPI void glfwGetWindowSize(GLFWwindow* window, int* width, int* height); */ GLFWAPI void glfwSetWindowSize(GLFWwindow* window, int width, int height); +/*! @brief Retrieves the size of the framebuffer of the specified window. + * + * This function retrieves the size, in pixels, of the framebuffer of the + * specified window. + * + * @param[in] window The window whose framebuffer to query. + * @param[out] width The width of the framebuffer. + * @param[out] height The height of the framebuffer. + * + * @sa glfwSetFramebufferSizeCallback + * + * @ingroup window + */ +GLFWAPI void glfwGetFramebufferSize(GLFWwindow* window, int* width, int* height); + /*! @brief Iconifies the specified window. * * This function iconifies/minimizes the specified window, if it was previously @@ -1604,6 +1634,21 @@ GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwi */ GLFWAPI GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow* window, GLFWwindowiconifyfun cbfun); +/*! @brief Sets the framebuffer resize callback for the specified window. + * + * This function sets the framebuffer resize callback of the specified window, + * which is called when the framebuffer of the specified window is resized. + * + * @param[in] window The window whose callback to set. + * @param[in] cbfun The new callback, or `NULL` to remove the currently set + * callback. + * + * @return The previously set callback, or `NULL` if an error occurred. + * + * @ingroup window + */ +GLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow* window, GLFWframebuffersizefun cbfun); + /*! @brief Processes all pending events. * * This function processes only those events that have already been received diff --git a/src/cocoa_window.m b/src/cocoa_window.m index 7b3ce1c8..1d066831 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -111,9 +111,11 @@ static void centerCursor(_GLFWwindow *window) { [window->nsgl.context update]; - int width, height; - _glfwPlatformGetWindowSize(window, &width, &height); - _glfwInputWindowSize(window, width, height); + const NSRect contentRect = [window->ns.view frame]; + const NSRect fbRect = [window->ns.view convertRectToBacking:contentRect]; + + _glfwInputFramebufferSize(window, fbRect.size.width, fbRect.size.height); + _glfwInputWindowSize(window, contentRect.size.width, contentRect.size.height); _glfwInputWindowDamage(window); if (window->cursorMode == GLFW_CURSOR_DISABLED) @@ -515,6 +517,14 @@ static int convertMacKeyCode(unsigned int macKeyCode) _glfwInputCursorEnter(window, GL_TRUE); } +- (void)viewDidChangeBackingProperties +{ + const NSRect contentRect = [window->ns.view frame]; + const NSRect fbRect = [window->ns.view convertRectToBacking:contentRect]; + + _glfwInputFramebufferSize(window, fbRect.size.width, fbRect.size.height); +} + - (void)updateTrackingAreas { if (trackingArea != nil) @@ -804,6 +814,8 @@ static GLboolean createWindow(_GLFWwindow* window, window->ns.view = [[GLFWContentView alloc] initWithGlfwWindow:window]; + [window->ns.view setWantsBestResolutionOpenGLSurface:YES]; + [window->ns.object setTitle:[NSString stringWithUTF8String:wndconfig->title]]; [window->ns.object setContentView:window->ns.view]; [window->ns.object setDelegate:window->ns.delegate]; @@ -927,6 +939,11 @@ void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height) [window->ns.object setContentSize:NSMakeSize(width, height)]; } +void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, int* height) +{ + _glfwPlatformGetWindowSize(window, width, height); +} + void _glfwPlatformIconifyWindow(_GLFWwindow* window) { if (window->monitor) diff --git a/src/internal.h b/src/internal.h index 4b0ee976..eb5d45ca 100644 --- a/src/internal.h +++ b/src/internal.h @@ -216,18 +216,19 @@ struct _GLFWwindow #endif struct { - GLFWwindowposfun pos; - GLFWwindowsizefun size; - GLFWwindowclosefun close; - GLFWwindowrefreshfun refresh; - GLFWwindowfocusfun focus; - GLFWwindowiconifyfun iconify; - GLFWmousebuttonfun mouseButton; - GLFWcursorposfun cursorPos; - GLFWcursorenterfun cursorEnter; - GLFWscrollfun scroll; - GLFWkeyfun key; - GLFWcharfun character; + GLFWwindowposfun pos; + GLFWwindowsizefun size; + GLFWwindowclosefun close; + GLFWwindowrefreshfun refresh; + GLFWwindowfocusfun focus; + GLFWwindowiconifyfun iconify; + GLFWframebuffersizefun fbsize; + GLFWmousebuttonfun mouseButton; + GLFWcursorposfun cursorPos; + GLFWcursorenterfun cursorEnter; + GLFWscrollfun scroll; + GLFWkeyfun key; + GLFWcharfun character; } callbacks; // This is defined in the window API's platform.h @@ -474,6 +475,11 @@ void _glfwPlatformGetWindowSize(_GLFWwindow* window, int* width, int* height); */ void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height); +/*! @copydoc glfwGetFramebufferSize + * @ingroup platform + */ +void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, int* height); + /*! @copydoc glfwIconifyWindow * @ingroup platform */ @@ -562,6 +568,14 @@ void _glfwInputWindowPos(_GLFWwindow* window, int xpos, int ypos); */ void _glfwInputWindowSize(_GLFWwindow* window, int width, int height); +/*! @brief Notifies shared code of a framebuffer resize event. + * @param[in] window The window that received the event. + * @param[in] width The new width, in pixels, of the framebuffer. + * @param[in] height The new height, in pixels, of the framebuffer. + * @ingroup event + */ +void _glfwInputFramebufferSize(_GLFWwindow* window, int width, int height); + /*! @brief Notifies shared code of a window iconification event. * @param[in] window The window that received the event. * @param[in] iconified `GL_TRUE` if the window was iconified, or `GL_FALSE` diff --git a/src/win32_window.c b/src/win32_window.c index 5fceb174..6d580d8c 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -645,6 +645,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, if (window->cursorMode == GLFW_CURSOR_DISABLED) updateClipRect(window); + _glfwInputFramebufferSize(window, LOWORD(lParam), HIWORD(lParam)); _glfwInputWindowSize(window, LOWORD(lParam), HIWORD(lParam)); return 0; } @@ -991,6 +992,11 @@ void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height) } } +void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, int* height) +{ + _glfwPlatformGetWindowSize(window, width, height); +} + void _glfwPlatformIconifyWindow(_GLFWwindow* window) { ShowWindow(window->win32.handle, SW_MINIMIZE); diff --git a/src/window.c b/src/window.c index e9b3fd16..fa948adf 100644 --- a/src/window.c +++ b/src/window.c @@ -113,6 +113,12 @@ void _glfwInputWindowIconify(_GLFWwindow* window, int iconified) window->callbacks.iconify((GLFWwindow*) window, iconified); } +void _glfwInputFramebufferSize(_GLFWwindow* window, int width, int height) +{ + if (window->callbacks.fbsize) + window->callbacks.fbsize((GLFWwindow*) window, width, height); +} + void _glfwInputWindowVisibility(_GLFWwindow* window, int visible) { window->visible = visible; @@ -478,6 +484,15 @@ GLFWAPI void glfwSetWindowSize(GLFWwindow* handle, int width, int height) _glfwPlatformSetWindowSize(window, width, height); } +GLFWAPI void glfwGetFramebufferSize(GLFWwindow* handle, int* width, int* height) +{ + _GLFWwindow* window = (_GLFWwindow*) handle; + + _GLFW_REQUIRE_INIT(); + + _glfwPlatformGetFramebufferSize(window, width, height); +} + GLFWAPI void glfwIconifyWindow(GLFWwindow* handle) { _GLFWwindow* window = (_GLFWwindow*) handle; @@ -665,6 +680,19 @@ GLFWAPI GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow* handle, return previous; } +GLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow* handle, + GLFWframebuffersizefun cbfun) +{ + _GLFWwindow* window = (_GLFWwindow*) handle; + GLFWframebuffersizefun previous; + + _GLFW_REQUIRE_INIT_OR_RETURN(NULL); + + previous = window->callbacks.fbsize; + window->callbacks.fbsize = cbfun; + return previous; +} + GLFWAPI void glfwPollEvents(void) { _GLFW_REQUIRE_INIT(); diff --git a/src/x11_window.c b/src/x11_window.c index 623f4cfe..c83cae75 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -635,6 +635,10 @@ static void processEvent(XEvent *event) case ConfigureNotify: { + _glfwInputFramebufferSize(window, + event->xconfigure.width, + event->xconfigure.height); + _glfwInputWindowSize(window, event->xconfigure.width, event->xconfigure.height); @@ -1021,6 +1025,11 @@ void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height) XFlush(_glfw.x11.display); } +void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, int* height) +{ + _glfwPlatformGetWindowSize(window, width, height); +} + void _glfwPlatformIconifyWindow(_GLFWwindow* window) { if (window->x11.overrideRedirect) diff --git a/tests/accuracy.c b/tests/accuracy.c index cc556335..752c6951 100644 --- a/tests/accuracy.c +++ b/tests/accuracy.c @@ -56,7 +56,7 @@ static void error_callback(int error, const char* description) fprintf(stderr, "Error: %s\n", description); } -static void window_size_callback(GLFWwindow* window, int width, int height) +static void framebuffer_size_callback(GLFWwindow* window, int width, int height) { window_width = width; window_height = height; @@ -98,13 +98,13 @@ int main(void) } glfwSetCursorPosCallback(window, cursor_position_callback); - glfwSetWindowSizeCallback(window, window_size_callback); + glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); glfwSetKeyCallback(window, key_callback); glfwMakeContextCurrent(window); - glfwGetWindowSize(window, &width, &height); - window_size_callback(window, width, height); + glfwGetFramebufferSize(window, &width, &height); + framebuffer_size_callback(window, width, height); set_swap_interval(window, swap_interval); diff --git a/tests/clipboard.c b/tests/clipboard.c index a20e59a9..8efd63fe 100644 --- a/tests/clipboard.c +++ b/tests/clipboard.c @@ -79,7 +79,7 @@ static void key_callback(GLFWwindow* window, int key, int action, int mods) } } -static void window_size_callback(GLFWwindow* window, int width, int height) +static void framebuffer_size_callback(GLFWwindow* window, int width, int height) { glViewport(0, 0, width, height); } @@ -124,7 +124,7 @@ int main(int argc, char** argv) glfwSwapInterval(1); glfwSetKeyCallback(window, key_callback); - glfwSetWindowSizeCallback(window, window_size_callback); + glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); glMatrixMode(GL_PROJECTION); glOrtho(-1.f, 1.f, -1.f, 1.f, -1.f, 1.f); diff --git a/tests/defaults.c b/tests/defaults.c index d03f27c8..2d483540 100644 --- a/tests/defaults.c +++ b/tests/defaults.c @@ -96,9 +96,9 @@ int main(void) } glfwMakeContextCurrent(window); - glfwGetWindowSize(window, &width, &height); + glfwGetFramebufferSize(window, &width, &height); - printf("window size: %ix%i\n", width, height); + printf("framebuffer size: %ix%i\n", width, height); for (i = 0; glfw_attribs[i].name; i++) { diff --git a/tests/events.c b/tests/events.c index 3056ba8a..a4e3476a 100644 --- a/tests/events.c +++ b/tests/events.c @@ -259,6 +259,15 @@ static void window_size_callback(GLFWwindow* window, int width, int height) glfwGetTime(), width, height); +} + +static void framebuffer_size_callback(GLFWwindow* window, int width, int height) +{ + printf("%08x at %0.3f: Framebuffer size: %i %i\n", + counter++, + glfwGetTime(), + width, + height); glViewport(0, 0, width, height); } @@ -422,6 +431,7 @@ int main(void) glfwSetWindowPosCallback(window, window_pos_callback); glfwSetWindowSizeCallback(window, window_size_callback); + glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); glfwSetWindowCloseCallback(window, window_close_callback); glfwSetWindowRefreshCallback(window, window_refresh_callback); glfwSetWindowFocusCallback(window, window_focus_callback); diff --git a/tests/fsaa.c b/tests/fsaa.c index a5422dd5..952264bb 100644 --- a/tests/fsaa.c +++ b/tests/fsaa.c @@ -43,7 +43,7 @@ static void error_callback(int error, const char* description) fprintf(stderr, "Error: %s\n", description); } -static void window_size_callback(GLFWwindow* window, int width, int height) +static void framebuffer_size_callback(GLFWwindow* window, int width, int height) { glViewport(0, 0, width, height); } @@ -107,7 +107,7 @@ int main(int argc, char** argv) } glfwSetKeyCallback(window, key_callback); - glfwSetWindowSizeCallback(window, window_size_callback); + glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); glfwMakeContextCurrent(window); glfwSwapInterval(1); diff --git a/tests/gamma.c b/tests/gamma.c index b8d66a81..136782db 100644 --- a/tests/gamma.c +++ b/tests/gamma.c @@ -91,7 +91,7 @@ static void key_callback(GLFWwindow* window, int key, int action, int mods) } } -static void size_callback(GLFWwindow* window, int width, int height) +static void framebuffer_size_callback(GLFWwindow* window, int width, int height) { glViewport(0, 0, width, height); } @@ -150,7 +150,7 @@ int main(int argc, char** argv) glfwSwapInterval(1); glfwSetKeyCallback(window, key_callback); - glfwSetWindowSizeCallback(window, size_callback); + glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); glMatrixMode(GL_PROJECTION); glOrtho(-1.f, 1.f, -1.f, 1.f, -1.f, 1.f); diff --git a/tests/iconify.c b/tests/iconify.c index 9e548eab..dc9b799c 100644 --- a/tests/iconify.c +++ b/tests/iconify.c @@ -68,6 +68,11 @@ static void key_callback(GLFWwindow* window, int key, int action, int mods) static void window_size_callback(GLFWwindow* window, int width, int height) { printf("%0.2f Window resized to %ix%i\n", glfwGetTime(), width, height); +} + +static void framebuffer_size_callback(GLFWwindow* window, int width, int height) +{ + printf("%0.2f Framebuffer resized to %ix%i\n", glfwGetTime(), width, height); glViewport(0, 0, width, height); } @@ -138,6 +143,7 @@ int main(int argc, char** argv) glfwSwapInterval(1); glfwSetKeyCallback(window, key_callback); + glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); glfwSetWindowSizeCallback(window, window_size_callback); glfwSetWindowFocusCallback(window, window_focus_callback); glfwSetWindowIconifyCallback(window, window_iconify_callback); @@ -150,7 +156,7 @@ int main(int argc, char** argv) while (!glfwWindowShouldClose(window)) { - glfwGetWindowSize(window, &width, &height); + glfwGetFramebufferSize(window, &width, &height); glScissor(0, 0, width, height); glClearColor(0, 0, 0, 0); diff --git a/tests/joysticks.c b/tests/joysticks.c index 37af25d0..61f27646 100644 --- a/tests/joysticks.c +++ b/tests/joysticks.c @@ -56,7 +56,7 @@ static void error_callback(int error, const char* description) fprintf(stderr, "Error: %s\n", description); } -static void window_size_callback(GLFWwindow* window, int width, int height) +static void framebuffer_size_callback(GLFWwindow* window, int width, int height) { glViewport(0, 0, width, height); } @@ -108,7 +108,7 @@ static void draw_joysticks(GLFWwindow* window) { int i, width, height; - glfwGetWindowSize(window, &width, &height); + glfwGetFramebufferSize(window, &width, &height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); @@ -208,7 +208,7 @@ int main(void) exit(EXIT_FAILURE); } - glfwSetWindowSizeCallback(window, window_size_callback); + glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); glfwMakeContextCurrent(window); glfwSwapInterval(1); diff --git a/tests/modes.c b/tests/modes.c index 4f0b9a8e..e92a262c 100644 --- a/tests/modes.c +++ b/tests/modes.c @@ -67,9 +67,9 @@ static void error_callback(int error, const char* description) fprintf(stderr, "Error: %s\n", description); } -static void window_size_callback(GLFWwindow* window, int width, int height) +static void framebuffer_size_callback(GLFWwindow* window, int width, int height) { - printf("Window resized to %ix%i\n", width, height); + printf("Framebuffer resized to %ix%i\n", width, height); glViewport(0, 0, width, height); } @@ -143,7 +143,7 @@ static void test_modes(GLFWmonitor* monitor) continue; } - glfwSetWindowSizeCallback(window, window_size_callback); + glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); glfwSetKeyCallback(window, key_callback); glfwMakeContextCurrent(window); diff --git a/tests/peter.c b/tests/peter.c index bd0979e8..51672831 100644 --- a/tests/peter.c +++ b/tests/peter.c @@ -87,7 +87,7 @@ static void key_callback(GLFWwindow* window, int key, int action, int mods) } } -static void window_size_callback(GLFWwindow* window, int width, int height) +static void framebuffer_size_callback(GLFWwindow* window, int width, int height) { glViewport(0, 0, width, height); } @@ -104,7 +104,7 @@ static GLFWwindow* open_window(void) glfwGetCursorPos(window, &cursor_x, &cursor_y); printf("Cursor position: %f %f\n", cursor_x, cursor_y); - glfwSetWindowSizeCallback(window, window_size_callback); + glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); glfwSetCursorPosCallback(window, cursor_position_callback); glfwSetKeyCallback(window, key_callback); diff --git a/tests/reopen.c b/tests/reopen.c index acac0a44..40f9ef75 100644 --- a/tests/reopen.c +++ b/tests/reopen.c @@ -44,7 +44,7 @@ static void error_callback(int error, const char* description) fprintf(stderr, "Error: %s\n", description); } -static void window_size_callback(GLFWwindow* window, int width, int height) +static void framebuffer_size_callback(GLFWwindow* window, int width, int height) { glViewport(0, 0, width, height); } @@ -82,7 +82,7 @@ static GLFWwindow* open_window(int width, int height, GLFWmonitor* monitor) glfwMakeContextCurrent(window); glfwSwapInterval(1); - glfwSetWindowSizeCallback(window, window_size_callback); + glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); glfwSetWindowCloseCallback(window, window_close_callback); glfwSetKeyCallback(window, key_callback); diff --git a/tests/sharing.c b/tests/sharing.c index 043bfd62..6a951c88 100644 --- a/tests/sharing.c +++ b/tests/sharing.c @@ -94,7 +94,7 @@ static GLuint create_texture(void) static void draw_quad(GLuint texture) { int width, height; - glfwGetWindowSize(glfwGetCurrentContext(), &width, &height); + glfwGetFramebufferSize(glfwGetCurrentContext(), &width, &height); glViewport(0, 0, width, height); diff --git a/tests/tearing.c b/tests/tearing.c index 79a3647e..58135ce8 100644 --- a/tests/tearing.c +++ b/tests/tearing.c @@ -59,7 +59,7 @@ static void error_callback(int error, const char* description) fprintf(stderr, "Error: %s\n", description); } -static void window_size_callback(GLFWwindow* window, int width, int height) +static void framebuffer_size_callback(GLFWwindow* window, int width, int height) { glViewport(0, 0, width, height); } @@ -95,7 +95,7 @@ int main(void) last_time = glfwGetTime(); frame_rate = 0.0; - glfwSetWindowSizeCallback(window, window_size_callback); + glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); glfwSetKeyCallback(window, key_callback); glMatrixMode(GL_PROJECTION); diff --git a/tests/title.c b/tests/title.c index 4b8c64c2..15ddb83f 100644 --- a/tests/title.c +++ b/tests/title.c @@ -37,7 +37,7 @@ static void error_callback(int error, const char* description) fprintf(stderr, "Error: %s\n", description); } -static void window_size_callback(GLFWwindow* window, int width, int height) +static void framebuffer_size_callback(GLFWwindow* window, int width, int height) { glViewport(0, 0, width, height); } @@ -61,7 +61,7 @@ int main(void) glfwMakeContextCurrent(window); glfwSwapInterval(1); - glfwSetWindowSizeCallback(window, window_size_callback); + glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); while (!glfwWindowShouldClose(window)) {