From b4e2f5b45c22e560bf785cf412154fc32d995e1e Mon Sep 17 00:00:00 2001 From: Jacques Heunis Date: Sat, 31 Mar 2018 12:22:44 +0200 Subject: [PATCH] Initialize the timer after the graphics device on desktop and web platforms. (#516) This is already the order that is used for Android. It doesn't appear to make a difference on desktop but on web using the timer before it's been initialized (by glfwInit, inside InitGraphicsDevice) causes the a long (and variable but often several seconds) sleep between the first and second frame. Fixes: 468309d ("Early-exit InitWindow if InitGraphicsDevice fails") --- src/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core.c b/src/core.c index 0532c3c4c..89a6f924a 100644 --- a/src/core.c +++ b/src/core.c @@ -442,14 +442,14 @@ void InitWindow(int width, int height, void *data) uwpWindow = (EGLNativeWindowType)data; #endif - // Init hi-res timer - InitTimer(); - // Init graphics device (display device and OpenGL context) // NOTE: returns true if window and graphic device has been initialized successfully windowReady = InitGraphicsDevice(width, height); if (!windowReady) return; + // Init hi-res timer + InitTimer(); + #if defined(SUPPORT_DEFAULT_FONT) // Load default font // NOTE: External function (defined in module: text)