GLFW: size, position & monitorsGLFW 3.0

glfwShowWindow

Makes a hidden window visible.

Signature

void glfwShowWindow(GLFWwindow* window);

How it works

Windows are visible right after glfwCreateWindow, unless you set the hint GLFW_VISIBLE to GLFW_FALSE. Hiding the window first lets you move it, resize it or draw a first frame before the user sees anything. Then call glfwShowWindow.

It does nothing if the window is already visible or in full screen. glfwHideWindow does the opposite.

Parameters

windowGLFWwindow*

The window to show.

Tips & pitfalls

  • Showing a window usually also gives it keyboard focus (hint GLFW_FOCUS_ON_SHOW, on by default).

Errors

When the call is invalid it does nothing and sets an error, which glGetError returns:

GLFW_NOT_INITIALIZED
Called before glfwInit or after glfwTerminate.
GLFW_PLATFORM_ERROR
The operating system or window system reported a failure; the description says which.

Example

example.cpp
1glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
2GLFWwindow* window = glfwCreateWindow(800, 600, "App", nullptr, nullptr);
3glfwSetWindowPos(window, 200, 150);
4glfwShowWindow(window);   // appears already in place
Official GLFW documentation