text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>GLFW: Vulkan reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="extra.css" rel="stylesheet" type="text/css"/>

		GLFW

Documentation

Download

Media

Community

Main Page

Related Pages

Modules

Data Structures

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

Typedefs |
Functions

Vulkan reference

Typedefs

typedef void(* 	GLFWvkproc) (void)

 	Vulkan API function pointer type.  More...

Functions

int 	glfwVulkanSupported (void)

 	Returns whether the Vulkan loader has been found.  More...

const char ** 	glfwGetRequiredInstanceExtensions (uint32_t *count)

 	Returns the Vulkan instance extensions required by GLFW.  More...

GLFWvkproc 	glfwGetInstanceProcAddress (VkInstance instance, const char *procname)

 	Returns the address of the specified Vulkan instance function.  More...

int 	glfwGetPhysicalDevicePresentationSupport (VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily)

 	Returns whether the specified queue family can present images.  More...

VkResult 	glfwCreateWindowSurface (VkInstance instance, GLFWwindow *window, const VkAllocationCallbacks *allocator, VkSurfaceKHR *surface)

 	Creates a Vulkan surface for the specified window.  More...

Detailed Description

This is the reference documentation for Vulkan related functions and types. For more task-oriented information, see the Vulkan guide.

Typedef Documentation

          typedef void(* GLFWvkproc) (void)

Generic function pointer used for returning Vulkan API function pointers without forcing a cast from a regular pointer.

See also

Querying Vulkan function pointers

glfwGetInstanceProcAddress

Since

Added in version 3.2.

Function Documentation

          VkResult glfwCreateWindowSurface
          (
          VkInstance
          instance,

          GLFWwindow *
          window,

          const VkAllocationCallbacks *
          allocator,

          VkSurfaceKHR *
          surface

          )

This function creates a Vulkan surface for the specified window.

If the Vulkan loader was not found at initialization, this function returns VK_ERROR_INITIALIZATION_FAILED and generates a GLFW_API_UNAVAILABLE error. Call glfwVulkanSupported to check whether the Vulkan loader was found.

If the required window surface creation instance extensions are not available or if the specified instance was not created with these extensions enabled, this function returns VK_ERROR_EXTENSION_NOT_PRESENT and generates a GLFW_API_UNAVAILABLE error. Call glfwGetRequiredInstanceExtensions to check what instance extensions are required.

The window surface must be destroyed before the specified Vulkan instance. It is the responsibility of the caller to destroy the window surface. GLFW does not destroy it for you. Call vkDestroySurfaceKHR to destroy the surface.

Parameters

[in]	instance	The Vulkan instance to create the surface in.

[in]	window	The window to create the surface for.

[in]	allocator	The allocator to use, or NULL to use the default allocator.

[out]	surface	Where to store the handle of the surface. This is set to VK_NULL_HANDLE if an error occurred.

Returns

VK_SUCCESS if successful, or a Vulkan error code if an error occurred.

Errors

Possible errors include GLFW_NOT_INITIALIZED, GLFW_API_UNAVAILABLE and GLFW_PLATFORM_ERROR.

Remarks

If an error occurs before the creation call is made, GLFW returns the Vulkan error code most appropriate for the error. Appropriate use of glfwVulkanSupported and glfwGetRequiredInstanceExtensions should eliminate almost all occurrences of these errors.

Thread safety

This function may be called from any thread. For synchronization details of Vulkan objects, see the Vulkan specification.

See also

Creating a Vulkan window surface

glfwGetRequiredInstanceExtensions

Since

Added in version 3.2.

          GLFWvkproc glfwGetInstanceProcAddress
          (
          VkInstance
          instance,

          const char *
          procname

          )

This function returns the address of the specified Vulkan core or extension function for the specified instance. If instance is set to NULL it can return any function exported from the Vulkan loader, including at least the following functions:

vkEnumerateInstanceExtensionProperties

vkEnumerateInstanceLayerProperties

vkCreateInstance

vkGetInstanceProcAddr

If Vulkan is not available on the machine, this function returns NULL and generates a GLFW_API_UNAVAILABLE error. Call glfwVulkanSupported to check whether Vulkan is available.

This function is equivalent to calling vkGetInstanceProcAddr with a platform-specific query of the Vulkan loader as a fallback.

Parameters

[in]	instance	The Vulkan instance to query, or NULL to retrieve functions related to instance creation.

[in]	procname	The ASCII encoded name of the function.

Returns

The address of the function, or NULL if an error occurred.

Errors

Possible errors include GLFW_NOT_INITIALIZED and GLFW_API_UNAVAILABLE.

Pointer lifetime

The returned function pointer is valid until the library is terminated.

Thread safety

This function may be called from any thread.

See also

Querying Vulkan function pointers

Since

Added in version 3.2.

          int glfwGetPhysicalDevicePresentationSupport
          (
          VkInstance
          instance,

          VkPhysicalDevice
          device,

          uint32_t
          queuefamily

          )

This function returns whether the specified queue family of the specified physical device supports presentation to the platform GLFW was built for.

If Vulkan or the required window surface creation instance extensions are not available on the machine, or if the specified instance was not created with the required extensions, this function returns GLFW_FALSE and generates a GLFW_API_UNAVAILABLE error. Call glfwVulkanSupported to check whether Vulkan is available and glfwGetRequiredInstanceExtensions to check what instance extensions are required.

Parameters

[in]	instance	The instance that the physical device belongs to.

[in]	device	The physical device that the queue family belongs to.

[in]	queuefamily	The index of the queue family to query.

Returns

GLFW_TRUE if the queue family supports presentation, or GLFW_FALSE otherwise.

Errors

Possible errors include GLFW_NOT_INITIALIZED, GLFW_API_UNAVAILABLE and GLFW_PLATFORM_ERROR.

Thread safety

This function may be called from any thread. For synchronization details of Vulkan objects, see the Vulkan specification.

See also

Querying for Vulkan presentation support

Since

Added in version 3.2.

          const char** glfwGetRequiredInstanceExtensions
          (
          uint32_t *
          count	)

This function returns an array of names of Vulkan instance extensions required by GLFW for creating Vulkan surfaces for GLFW windows. If successful, the list will always contains VK_KHR_surface, so if you don't require any additional extensions you can pass this list directly to the VkInstanceCreateInfo struct.

If Vulkan is not available on the machine, this function returns NULL and generates a GLFW_API_UNAVAILABLE error. Call glfwVulkanSupported to check whether Vulkan is available.

If Vulkan is available but no set of extensions allowing window surface creation was found, this function returns NULL. You may still use Vulkan for off-screen rendering and compute work.

Parameters

[out]	count	Where to store the number of extensions in the returned array. This is set to zero if an error occurred.

Returns

An array of ASCII encoded extension names, or NULL if an error occurred.

Errors

Possible errors include GLFW_NOT_INITIALIZED and GLFW_API_UNAVAILABLE.

Remarks

Additional extensions may be required by future versions of GLFW. You should check if any extensions you wish to enable are already in the returned array, as it is an error to specify an extension more than once in the VkInstanceCreateInfo struct.

Pointer lifetime

The returned array is allocated and freed by GLFW. You should not free it yourself. It is guaranteed to be valid only until the library is terminated.

Thread safety

This function may be called from any thread.

See also

Querying required Vulkan extensions

glfwCreateWindowSurface

Since

Added in version 3.2.

          int glfwVulkanSupported
          (
          void
          	)

This function returns whether the Vulkan loader has been found. This check is performed by glfwInit.

The availability of a Vulkan loader does not by itself guarantee that window surface creation or even device creation is possible. Call glfwGetRequiredInstanceExtensions to check whether the extensions necessary for Vulkan surface creation are available and glfwGetPhysicalDevicePresentationSupport to check whether a queue family of a physical device supports image presentation.

Returns

GLFW_TRUE if Vulkan is available, or GLFW_FALSE otherwise.

Errors

Possible errors include GLFW_NOT_INITIALIZED.

Thread safety

This function may be called from any thread.

See also

Querying for Vulkan support

Since

Added in version 3.2.

<address class="footer">

Last update on Thu Aug 18 2016 for GLFW 3.2.1

</address>


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>GLFW: Keyboard keys</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="extra.css" rel="stylesheet" type="text/css"/>

		GLFW

Documentation

Download

Media

Community

Main Page

Related Pages

Modules

Data Structures

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

Macros

Keyboard keys
Input reference

Macros

#define 	GLFW_KEY_UNKNOWN   -1

#define 	GLFW_KEY_SPACE   32

#define 	GLFW_KEY_APOSTROPHE   39  /* ' */

#define 	GLFW_KEY_COMMA   44  /* , */

#define 	GLFW_KEY_MINUS   45  /* - */

#define 	GLFW_KEY_PERIOD   46  /* . */

#define 	GLFW_KEY_SLASH   47  /* / */

#define 	GLFW_KEY_0   48

#define 	GLFW_KEY_1   49

#define 	GLFW_KEY_2   50

#define 	GLFW_KEY_3   51

#define 	GLFW_KEY_4   52

#define 	GLFW_KEY_5   53

#define 	GLFW_KEY_6   54

#define 	GLFW_KEY_7   55

#define 	GLFW_KEY_8   56

#define 	GLFW_KEY_9   57

#define 	GLFW_KEY_SEMICOLON   59  /* ; */

#define 	GLFW_KEY_EQUAL   61  /* = */

#define 	GLFW_KEY_A   65

#define 	GLFW_KEY_B   66

#define 	GLFW_KEY_C   67

#define 	GLFW_KEY_D   68

#define 	GLFW_KEY_E   69

#define 	GLFW_KEY_F   70

#define 	GLFW_KEY_G   71

#define 	GLFW_KEY_H   72

#define 	GLFW_KEY_I   73

#define 	GLFW_KEY_J   74

#define 	GLFW_KEY_K   75

#define 	GLFW_KEY_L   76

#define 	GLFW_KEY_M   77

#define 	GLFW_KEY_N   78

#define 	GLFW_KEY_O   79

#define 	GLFW_KEY_P   80

#define 	GLFW_KEY_Q   81

#define 	GLFW_KEY_R   82

#define 	GLFW_KEY_S   83

#define 	GLFW_KEY_T   84

#define 	GLFW_KEY_U   85

#define 	GLFW_KEY_V   86

#define 	GLFW_KEY_W   87

#define 	GLFW_KEY_X   88

#define 	GLFW_KEY_Y   89

#define 	GLFW_KEY_Z   90

#define 	GLFW_KEY_LEFT_BRACKET   91  /* [ */

#define 	GLFW_KEY_BACKSLASH   92  /* \ */

#define 	GLFW_KEY_RIGHT_BRACKET   93  /* ] */

#define 	GLFW_KEY_GRAVE_ACCENT   96  /* ` */

#define 	GLFW_KEY_WORLD_1   161 /* non-US #1 */

#define 	GLFW_KEY_WORLD_2   162 /* non-US #2 */

#define 	GLFW_KEY_ESCAPE   256

#define 	GLFW_KEY_ENTER   257

#define 	GLFW_KEY_TAB   258

#define 	GLFW_KEY_BACKSPACE   259

#define 	GLFW_KEY_INSERT   260

#define 	GLFW_KEY_DELETE   261

#define 	GLFW_KEY_RIGHT   262

#define 	GLFW_KEY_LEFT   263

#define 	GLFW_KEY_DOWN   264

#define 	GLFW_KEY_UP   265

#define 	GLFW_KEY_PAGE_UP   266

#define 	GLFW_KEY_PAGE_DOWN   267

#define 	GLFW_KEY_HOME   268

#define 	GLFW_KEY_END   269

#define 	GLFW_KEY_CAPS_LOCK   280

#define 	GLFW_KEY_SCROLL_LOCK   281

#define 	GLFW_KEY_NUM_LOCK   282

#define 	GLFW_KEY_PRINT_SCREEN   283

#define 	GLFW_KEY_PAUSE   284

#define 	GLFW_KEY_F1   290

#define 	GLFW_KEY_F2   291

#define 	GLFW_KEY_F3   292

#define 	GLFW_KEY_F4   293

#define 	GLFW_KEY_F5   294

#define 	GLFW_KEY_F6   295

#define 	GLFW_KEY_F7   296

#define 	GLFW_KEY_F8   297

#define 	GLFW_KEY_F9   298

#define 	GLFW_KEY_F10   299

#define 	GLFW_KEY_F11   300

#define 	GLFW_KEY_F12   301

#define 	GLFW_KEY_F13   302

#define 	GLFW_KEY_F14   303

#define 	GLFW_KEY_F15   304

#define 	GLFW_KEY_F16   305

#define 	GLFW_KEY_F17   306

#define 	GLFW_KEY_F18   307

#define 	GLFW_KEY_F19   308

#define 	GLFW_KEY_F20   309

#define 	GLFW_KEY_F21   310

#define 	GLFW_KEY_F22   311

#define 	GLFW_KEY_F23   312

#define 	GLFW_KEY_F24   313

#define 	GLFW_KEY_F25   314

#define 	GLFW_KEY_KP_0   320

#define 	GLFW_KEY_KP_1   321

#define 	GLFW_KEY_KP_2   322

#define 	GLFW_KEY_KP_3   323

#define 	GLFW_KEY_KP_4   324

#define 	GLFW_KEY_KP_5   325

#define 	GLFW_KEY_KP_6   326

#define 	GLFW_KEY_KP_7   327

#define 	GLFW_KEY_KP_8   328

#define 	GLFW_KEY_KP_9   329

#define 	GLFW_KEY_KP_DECIMAL   330

#define 	GLFW_KEY_KP_DIVIDE   331

#define 	GLFW_KEY_KP_MULTIPLY   332

#define 	GLFW_KEY_KP_SUBTRACT   333

#define 	GLFW_KEY_KP_ADD   334

#define 	GLFW_KEY_KP_ENTER   335

#define 	GLFW_KEY_KP_EQUAL   336

#define 	GLFW_KEY_LEFT_SHIFT   340

#define 	GLFW_KEY_LEFT_CONTROL   341

#define 	GLFW_KEY_LEFT_ALT   342

#define 	GLFW_KEY_LEFT_SUPER   343

#define 	GLFW_KEY_RIGHT_SHIFT   344

#define 	GLFW_KEY_RIGHT_CONTROL   345

#define 	GLFW_KEY_RIGHT_ALT   346

#define 	GLFW_KEY_RIGHT_SUPER   347

#define 	GLFW_KEY_MENU   348

#define 	GLFW_KEY_LAST   GLFW_KEY_MENU

Detailed Description

See key input for how these are used.

These key codes are inspired by the USB HID Usage Tables v1.12 (p. 53-60), but re-arranged to map to 7-bit ASCII for printable keys (function keys are put in the 256+ range).

The naming of the key codes follow these rules:

The US keyboard layout is used

Names of printable alpha-numeric characters are used (e.g. "A", "R", "3", etc.)

For non-alphanumeric characters, Unicode:ish names are used (e.g. "COMMA", "LEFT_SQUARE_BRACKET", etc.). Note that some names do not correspond to the Unicode standard (usually for brevity)

Keys that lack a clear US mapping are named "WORLD_x"

For non-printable keys, custom names are used (e.g. "F4", "BACKSPACE", etc.)

Macro Definition Documentation

          #define GLFW_KEY_0   48

          #define GLFW_KEY_1   49

          #define GLFW_KEY_2   50

          #define GLFW_KEY_3   51

          #define GLFW_KEY_4   52

          #define GLFW_KEY_5   53

          #define GLFW_KEY_6   54

          #define GLFW_KEY_7   55

          #define GLFW_KEY_8   56

          #define GLFW_KEY_9   57

          #define GLFW_KEY_A   65

          #define GLFW_KEY_APOSTROPHE   39  /* ' */

          #define GLFW_KEY_B   66

          #define GLFW_KEY_BACKSLASH   92  /* \ */

          #define GLFW_KEY_BACKSPACE   259

          #define GLFW_KEY_C   67

          #define GLFW_KEY_CAPS_LOCK   280

          #define GLFW_KEY_COMMA   44  /* , */

          #define GLFW_KEY_D   68

          #define GLFW_KEY_DELETE   261

          #define GLFW_KEY_DOWN   264

          #define GLFW_KEY_E   69

          #define GLFW_KEY_END   269

          #define GLFW_KEY_ENTER   257

          #define GLFW_KEY_EQUAL   61  /* = */

          #define GLFW_KEY_ESCAPE   256

          #define GLFW_KEY_F   70

          #define GLFW_KEY_F1   290

          #define GLFW_KEY_F10   299

          #define GLFW_KEY_F11   300

          #define GLFW_KEY_F12   301

          #define GLFW_KEY_F13   302

          #define GLFW_KEY_F14   303

          #define GLFW_KEY_F15   304

          #define GLFW_KEY_F16   305

          #define GLFW_KEY_F17   306

          #define GLFW_KEY_F18   307

          #define GLFW_KEY_F19   308

          #define GLFW_KEY_F2   291

          #define GLFW_KEY_F20   309

          #define GLFW_KEY_F21   310

          #define GLFW_KEY_F22   311

          #define GLFW_KEY_F23   312

          #define GLFW_KEY_F24   313

          #define GLFW_KEY_F25   314

          #define GLFW_KEY_F3   292

          #define GLFW_KEY_F4   293

          #define GLFW_KEY_F5   294

          #define GLFW_KEY_F6   295

          #define GLFW_KEY_F7   296

          #define GLFW_KEY_F8   297

          #define GLFW_KEY_F9   298

          #define GLFW_KEY_G   71

          #define GLFW_KEY_GRAVE_ACCENT   96  /* ` */

          #define GLFW_KEY_H   72

          #define GLFW_KEY_HOME   268

          #define GLFW_KEY_I   73

          #define GLFW_KEY_INSERT   260

          #define GLFW_KEY_J   74

          #define GLFW_KEY_K   75

          #define GLFW_KEY_KP_0   320

          #define GLFW_KEY_KP_1   321

          #define GLFW_KEY_KP_2   322

          #define GLFW_KEY_KP_3   323

          #define GLFW_KEY_KP_4   324

          #define GLFW_KEY_KP_5   325

          #define GLFW_KEY_KP_6   326

          #define GLFW_KEY_KP_7   327

          #define GLFW_KEY_KP_8   328

          #define GLFW_KEY_KP_9   329

          #define GLFW_KEY_KP_ADD   334

          #define GLFW_KEY_KP_DECIMAL   330

          #define GLFW_KEY_KP_DIVIDE   331

          #define GLFW_KEY_KP_ENTER   335

          #define GLFW_KEY_KP_EQUAL   336

          #define GLFW_KEY_KP_MULTIPLY   332

          #define GLFW_KEY_KP_SUBTRACT   333

          #define GLFW_KEY_L   76

          #define GLFW_KEY_LAST   GLFW_KEY_MENU

          #define GLFW_KEY_LEFT   263

          #define GLFW_KEY_LEFT_ALT   342

          #define GLFW_KEY_LEFT_BRACKET   91  /* [ */

          #define GLFW_KEY_LEFT_CONTROL   341

          #define GLFW_KEY_LEFT_SHIFT   340

          #define GLFW_KEY_LEFT_SUPER   343

          #define GLFW_KEY_M   77

          #define GLFW_KEY_MENU   348

          #define GLFW_KEY_MINUS   45  /* - */

          #define GLFW_KEY_N   78

          #define GLFW_KEY_NUM_LOCK   282

          #define GLFW_KEY_O   79

          #define GLFW_KEY_P   80

          #define GLFW_KEY_PAGE_DOWN   267

          #define GLFW_KEY_PAGE_UP   266

          #define GLFW_KEY_PAUSE   284

          #define GLFW_KEY_PERIOD   46  /* . */

          #define GLFW_KEY_PRINT_SCREEN   283

          #define GLFW_KEY_Q   81

          #define GLFW_KEY_R   82

          #define GLFW_KEY_RIGHT   262

          #define GLFW_KEY_RIGHT_ALT   346

          #define GLFW_KEY_RIGHT_BRACKET   93  /* ] */

          #define GLFW_KEY_RIGHT_CONTROL   345

          #define GLFW_KEY_RIGHT_SHIFT   344

          #define GLFW_KEY_RIGHT_SUPER   347

          #define GLFW_KEY_S   83

          #define GLFW_KEY_SCROLL_LOCK   281

          #define GLFW_KEY_SEMICOLON   59  /* ; */

          #define GLFW_KEY_SLASH   47  /* / */

          #define GLFW_KEY_SPACE   32

          #define GLFW_KEY_T   84

          #define GLFW_KEY_TAB   258

          #define GLFW_KEY_U   85

          #define GLFW_KEY_UNKNOWN   -1

          #define GLFW_KEY_UP   265

          #define GLFW_KEY_V   86

          #define GLFW_KEY_W   87

          #define GLFW_KEY_WORLD_1   161 /* non-US #1 */

          #define GLFW_KEY_WORLD_2   162 /* non-US #2 */

          #define GLFW_KEY_X   88

          #define GLFW_KEY_Y   89

          #define GLFW_KEY_Z   90

<address class="footer">

Last update on Thu Aug 18 2016 for GLFW 3.2.1

</address>

repo_language: C

mime_type: text/x-c


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>GLFW: Globals</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="extra.css" rel="stylesheet" type="text/css"/>

		GLFW

Documentation

Download

Media

Community

Main Page

Related Pages

Modules

Data Structures

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

File List

Globals

All

Functions

Typedefs

Macros

a

b

c

d

e

f

g

h

i

j

k

l

m

n

o

p

r

s

t

v

- p -

GLFW_PLATFORM_ERROR
: glfw3.h

GLFW_PRESS
: glfw3.h

<address class="footer">

Last update on Thu Aug 18 2016 for GLFW 3.2.1

</address>


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>GLFW: Globals</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="extra.css" rel="stylesheet" type="text/css"/>

		GLFW

Documentation

Download

Media

Community

Main Page

Related Pages

Modules

Data Structures

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

File List

Globals

All

Functions

Typedefs

Macros

a

b

c

d

e

f

g

h

i

j

k

l

m

n

o

p

r

s

t

v

- b -

GLFW_BLUE_BITS
: glfw3.h

<address class="footer">

Last update on Thu Aug 18 2016 for GLFW 3.2.1

</address>


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>GLFW: Data Structures</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="extra.css" rel="stylesheet" type="text/css"/>

		GLFW

Documentation

Download

Media

Community

Main Page

Related Pages

Modules

Data Structures

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

Data Structures

Data Structure Index

Data Fields

Data Structures

Here are the data structures with brief descriptions:

 CGLFWgammaramp	Gamma ramp

 CGLFWimage	Image data

 CGLFWvidmode	Video mode type

<address class="footer">

Last update on Thu Aug 18 2016 for GLFW 3.2.1

</address>


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>GLFW: Globals</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="extra.css" rel="stylesheet" type="text/css"/>

		GLFW

Documentation

Download

Media

Community

Main Page

Related Pages

Modules

Data Structures

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

File List

Globals

All

Functions

Typedefs

Macros

a

b

c

d

e

f

g

h

i

j

k

l

m

n

o

p

r

s

t

v

- j -

GLFW_JOYSTICK_1
: glfw3.h

GLFW_JOYSTICK_10
: glfw3.h

GLFW_JOYSTICK_11
: glfw3.h

GLFW_JOYSTICK_12
: glfw3.h

GLFW_JOYSTICK_13
: glfw3.h

GLFW_JOYSTICK_14
: glfw3.h

GLFW_JOYSTICK_15
: glfw3.h

GLFW_JOYSTICK_16
: glfw3.h

GLFW_JOYSTICK_2
: glfw3.h

GLFW_JOYSTICK_3
: glfw3.h

GLFW_JOYSTICK_4
: glfw3.h

GLFW_JOYSTICK_5
: glfw3.h

GLFW_JOYSTICK_6
: glfw3.h

GLFW_JOYSTICK_7
: glfw3.h

GLFW_JOYSTICK_8
: glfw3.h

GLFW_JOYSTICK_9
: glfw3.h

GLFW_JOYSTICK_LAST
: glfw3.h

<address class="footer">

Last update on Thu Aug 18 2016 for GLFW 3.2.1

</address>


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>GLFW: Globals</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="extra.css" rel="stylesheet" type="text/css"/>

		GLFW

Documentation

Download

Media

Community

Main Page

Related Pages

Modules

Data Structures

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

File List

Globals

All

Functions

Typedefs

Macros

a

b

c

d

e

f

g

h

i

j

k

l

m

n

o

p

r

s

t

v

- f -

GLFW_FALSE
: glfw3.h

GLFW_FLOATING
: glfw3.h

GLFW_FOCUSED
: glfw3.h

GLFW_FORMAT_UNAVAILABLE
: glfw3.h

<address class="footer">

Last update on Thu Aug 18 2016 for GLFW 3.2.1

</address>


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>GLFW: Window guide</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="extra.css" rel="stylesheet" type="text/css"/>

		GLFW

Documentation

Download

Media

Community

Main Page

Related Pages

Modules

Data Structures

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

Window guide

Table of Contents

Window objects

Window creation

Full screen windows

"Windowed full screen" windows

Window destruction

Window creation hints

Hard and soft constraints

Window related hints

Framebuffer related hints

Monitor related hints

Context related hints

Supported and default values

Window event processing

Window properties and events

User pointer

Window closing and close flag

Window size

Framebuffer size

Window size limits

Window position

Window title

Window icon

Window monitor

Window iconification

Window visibility

Window input focus

Window damage and refresh

Window attributes

Window related attributes

Context related attributes

Framebuffer related attributes

Buffer swapping

This guide introduces the window related functions of GLFW. For details on a specific function in this category, see the Window reference. There are also guides for the other areas of GLFW.

Introduction to the API

Context guide

Vulkan guide

Monitor guide

Input guide

Window objects

The GLFWwindow object encapsulates both a window and a context. They are created with glfwCreateWindow and destroyed with glfwDestroyWindow, or glfwTerminate, if any remain. As the window and context are inseparably linked, the object pointer is used as both a context and window handle.

To see the event stream provided to the various window related callbacks, run the events test program.

Window creation

A window and its OpenGL or OpenGL ES context are created with glfwCreateWindow, which returns a handle to the created window object. For example, this creates a 640 by 480 windowed mode window:

GLFWwindow* window = glfwCreateWindow(640, 480, "My Title", NULL, NULL);

If window creation fails, NULL will be returned, so it is necessary to check the return value.

The window handle is passed to all window related functions and is provided to along with all input events, so event handlers can tell which window received the event.

Full screen windows

To create a full screen window, you need to specify which monitor the window should use. In most cases, the user's primary monitor is a good choice. For more information about retrieving monitors, see Retrieving monitors.

GLFWwindow* window = glfwCreateWindow(640, 480, "My Title", glfwGetPrimaryMonitor(), NULL);

Full screen windows cover the entire display area of a monitor, have no border or decorations.

Windowed mode windows can be made full screen by setting a monitor with glfwSetWindowMonitor, and full screen ones can be made windowed by unsetting it with the same function.

Each field of the GLFWvidmode structure corresponds to a function parameter or window hint and combine to form the desired video mode for that window. The supported video mode most closely matching the desired video mode will be set for the chosen monitor as long as the window has input focus. For more information about retrieving video modes, see Video modes.

Video mode field 	Corresponds to

GLFWvidmode.width 	width parameter

GLFWvidmode.height 	height parameter

GLFWvidmode.redBits 	GLFW_RED_BITS hint

GLFWvidmode.greenBits 	GLFW_GREEN_BITS hint

GLFWvidmode.blueBits 	GLFW_BLUE_BITS hint

GLFWvidmode.refreshRate 	GLFW_REFRESH_RATE hint

Once you have a full screen window, you can change its resolution, refresh rate and monitor with glfwSetWindowMonitor. If you just need change its resolution you can also call glfwSetWindowSize. In all cases, the new video mode will be selected the same way as the video mode chosen by glfwCreateWindow. If the window has an OpenGL or OpenGL ES context, it will be unaffected.

By default, the original video mode of the monitor will be restored and the window iconified if it loses input focus, to allow the user to switch back to the desktop. This behavior can be disabled with the GLFW_AUTO_ICONIFY window hint, for example if you wish to simultaneously cover multiple windows with full screen windows.

"Windowed full screen" windows

If the closest match for the desired video mode is the current one, the video mode will not be changed, making window creation faster and application switching much smoother. This is sometimes called windowed full screen or borderless full screen window and counts as a full screen window. To create such a window, simply request the current video mode.

const GLFWvidmode* mode = glfwGetVideoMode(monitor);

glfwWindowHint(GLFW_RED_BITS, mode->redBits);

glfwWindowHint(GLFW_GREEN_BITS, mode->greenBits);

glfwWindowHint(GLFW_BLUE_BITS, mode->blueBits);

glfwWindowHint(GLFW_REFRESH_RATE, mode->refreshRate);

GLFWwindow* window = glfwCreateWindow(mode->width, mode->height, "My Title", monitor, NULL);

This also works for windowed mode windows that are made full screen.

const GLFWvidmode* mode = glfwGetVideoMode(monitor);

glfwSetWindowMonitor(window, monitor, 0, 0, mode->width, mode->height, mode->refreshRate);

Note that glfwGetVideoMode returns the current video mode of a monitor, so if you already have a full screen window on that monitor that you want to make windowed full screen, you need to have saved the desktop resolution before.

Window destruction

When a window is no longer needed, destroy it with glfwDestroyWindow.

glfwDestroyWindow(window);

Window destruction always succeeds. Before the actual destruction, all callbacks are removed so no further events will be delivered for the window. All windows remaining when glfwTerminate is called are destroyed as well.

When a full screen window is destroyed, the original video mode of its monitor is restored, but the gamma ramp is left untouched.

Window creation hints

There are a number of hints that can be set before the creation of a window and context. Some affect the window itself, others affect the framebuffer or context. These hints are set to their default values each time the library is initialized with glfwInit, can be set individually with glfwWindowHint and reset all at once to their defaults with glfwDefaultWindowHints.

Note that hints need to be set before the creation of the window and context you wish to have the specified attributes.

Hard and soft constraints

Some window hints are hard constraints. These must match the available capabilities exactly for window and context creation to succeed. Hints that are not hard constraints are matched as closely as possible, but the resulting context and framebuffer may differ from what these hints requested.

The following hints are always hard constraints:

GLFW_STEREO

GLFW_DOUBLEBUFFER

GLFW_CLIENT_API

GLFW_CONTEXT_CREATION_API

The following additional hints are hard constraints when requesting an OpenGL context, but are ignored when requesting an OpenGL ES context:

GLFW_OPENGL_FORWARD_COMPAT

GLFW_OPENGL_PROFILE

Window related hints

GLFW_RESIZABLE specifies whether the windowed mode window will be resizable by the user. The window will still be resizable using the glfwSetWindowSize function. This hint is ignored for full screen windows.

GLFW_VISIBLE specifies whether the windowed mode window will be initially visible. This hint is ignored for full screen windows.

GLFW_DECORATED specifies whether the windowed mode window will have window decorations such as a border, a close widget, etc. An undecorated window may still allow the user to generate close events on some platforms. This hint is ignored for full screen windows.

GLFW_FOCUSED specifies whether the windowed mode window will be given input focus when created. This hint is ignored for full screen and initially hidden windows.

GLFW_AUTO_ICONIFY specifies whether the full screen window will automatically iconify and restore the previous video mode on input focus loss. This hint is ignored for windowed mode windows.

GLFW_FLOATING specifies whether the windowed mode window will be floating above other regular windows, also called topmost or always-on-top. This is intended primarily for debugging purposes and cannot be used to implement proper full screen windows. This hint is ignored for full screen windows.

GLFW_MAXIMIZED specifies whether the windowed mode window will be maximized when created. This hint is ignored for full screen windows.

Framebuffer related hints

GLFW_RED_BITS, GLFW_GREEN_BITS, GLFW_BLUE_BITS, GLFW_ALPHA_BITS, GLFW_DEPTH_BITS and GLFW_STENCIL_BITS specify the desired bit depths of the various components of the default framebuffer. GLFW_DONT_CARE means the application has no preference.

GLFW_ACCUM_RED_BITS, GLFW_ACCUM_GREEN_BITS, GLFW_ACCUM_BLUE_BITS and GLFW_ACCUM_ALPHA_BITS specify the desired bit depths of the various components of the accumulation buffer. GLFW_DONT_CARE means the application has no preference.

Accumulation buffers are a legacy OpenGL feature and should not be used in new code.

GLFW_AUX_BUFFERS specifies the desired number of auxiliary buffers. GLFW_DONT_CARE means the application has no preference.

Auxiliary buffers are a legacy OpenGL feature and should not be used in new code.

GLFW_STEREO specifies whether to use stereoscopic rendering. This is a hard constraint.

GLFW_SAMPLES specifies the desired number of samples to use for multisampling. Zero disables multisampling. GLFW_DONT_CARE means the application has no preference.

GLFW_SRGB_CAPABLE specifies whether the framebuffer should be sRGB capable. If supported, a created OpenGL context will support the GL_FRAMEBUFFER_SRGB enable, also called GL_FRAMEBUFFER_SRGB_EXT) for controlling sRGB rendering and a created OpenGL ES context will always have sRGB rendering enabled.

GLFW_DOUBLEBUFFER specifies whether the framebuffer should be double buffered. You nearly always want to use double buffering. This is a hard constraint.

Monitor related hints

GLFW_REFRESH_RATE specifies the desired refresh rate for full screen windows. If set to GLFW_DONT_CARE, the highest available refresh rate will be used. This hint is ignored for windowed mode windows.

Context related hints

GLFW_CLIENT_API specifies which client API to create the context for. Possible values are GLFW_OPENGL_API, GLFW_OPENGL_ES_API and GLFW_NO_API. This is a hard constraint.

GLFW_CONTEXT_CREATION_API specifies which context creation API to use to create the context. Possible values are GLFW_NATIVE_CONTEXT_API and GLFW_EGL_CONTEXT_API. This is a hard constraint. If no client API is requested, this hint is ignored.

OS X: The EGL API is not available on this platform and requests to use it will fail.

Wayland, Mir: The EGL API is the native context creation API, so this hint will have no effect.

Note

An OpenGL extension loader library that assumes it knows which context creation API is used on a given platform may fail if you change this hint. This can be resolved by having it load via glfwGetProcAddress, which always uses the selected API.

Bug:

On some Linux systems, creating contexts via both the native and EGL APIs in a single process will cause the application to segfault. Stick to one API or the other on Linux for now.

GLFW_CONTEXT_VERSION_MAJOR and GLFW_CONTEXT_VERSION_MINOR specify the client API version that the created context must be compatible with. The exact behavior of these hints depend on the requested client API.

OpenGL: GLFW_CONTEXT_VERSION_MAJOR and GLFW_CONTEXT_VERSION_MINOR are not hard constraints, but creation will fail if the OpenGL version of the created context is less than the one requested. It is therefore perfectly safe to use the default of version 1.0 for legacy code and you will still get backwards-compatible contexts of version 3.0 and above when available.

While there is no way to ask the driver for a context of the highest supported version, GLFW will attempt to provide this when you ask for a version 1.0 context, which is the default for these hints.

OpenGL ES: GLFW_CONTEXT_VERSION_MAJOR and GLFW_CONTEXT_VERSION_MINOR are not hard constraints, but creation will fail if the OpenGL ES version of the created context is less than the one requested. Additionally, OpenGL ES 1.x cannot be returned if 2.0 or later was requested, and vice versa. This is because OpenGL ES 3.x is backward compatible with 2.0, but OpenGL ES 2.0 is not backward compatible with 1.x.

GLFW_OPENGL_FORWARD_COMPAT specifies whether the OpenGL context should be forward-compatible, i.e. one where all functionality deprecated in the requested version of OpenGL is removed. This must only be used if the requested OpenGL version is 3.0 or above. If OpenGL ES is requested, this hint is ignored.

Forward-compatibility is described in detail in the OpenGL Reference Manual.

GLFW_OPENGL_DEBUG_CONTEXT specifies whether to create a debug OpenGL context, which may have additional error and performance issue reporting functionality. If OpenGL ES is requested, this hint is ignored.

GLFW_OPENGL_PROFILE specifies which OpenGL profile to create the context for. Possible values are one of GLFW_OPENGL_CORE_PROFILE or GLFW_OPENGL_COMPAT_PROFILE, or GLFW_OPENGL_ANY_PROFILE to not request a specific profile. If requesting an OpenGL version below 3.2, GLFW_OPENGL_ANY_PROFILE must be used. If OpenGL ES is requested, this hint is ignored.

OpenGL profiles are described in detail in the OpenGL Reference Manual.

GLFW_CONTEXT_ROBUSTNESS specifies the robustness strategy to be used by the context. This can be one of GLFW_NO_RESET_NOTIFICATION or GLFW_LOSE_CONTEXT_ON_RESET, or GLFW_NO_ROBUSTNESS to not request a robustness strategy.

GLFW_CONTEXT_RELEASE_BEHAVIOR specifies the release behavior to be used by the context. Possible values are one of GLFW_ANY_RELEASE_BEHAVIOR, GLFW_RELEASE_BEHAVIOR_FLUSH or GLFW_RELEASE_BEHAVIOR_NONE. If the behavior is GLFW_ANY_RELEASE_BEHAVIOR, the default behavior of the context creation API will be used. If the behavior is GLFW_RELEASE_BEHAVIOR_FLUSH, the pipeline will be flushed whenever the context is released from being the current one. If the behavior is GLFW_RELEASE_BEHAVIOR_NONE, the pipeline will not be flushed on release.

Context release behaviors are described in detail by the GL_KHR_context_flush_control extension.

GLFW_CONTEXT_NO_ERROR specifies whether errors should be generated by the context. If enabled, situations that would have generated errors instead cause undefined behavior.

The no error mode for OpenGL and OpenGL ES is described in detail by the GL_KHR_no_error extension.

Note

This hint is experimental in its current state. There are currently (October 2015) no corresponding WGL or GLX extensions. That makes this hint a hard constraint for those backends, as creation will fail if unsupported context flags are requested. Once the extensions are available, they will be required and creation of GL_KHR_no_error contexts may fail on early drivers where this flag is supported without those extensions being listed.

Supported and default values

Window hint 	Default value 	Supported values

GLFW_RESIZABLE 	GLFW_TRUE 	GLFW_TRUE or GLFW_FALSE

GLFW_VISIBLE 	GLFW_TRUE 	GLFW_TRUE or GLFW_FALSE

GLFW_DECORATED 	GLFW_TRUE 	GLFW_TRUE or GLFW_FALSE

GLFW_FOCUSED 	GLFW_TRUE 	GLFW_TRUE or GLFW_FALSE

GLFW_AUTO_ICONIFY 	GLFW_TRUE 	GLFW_TRUE or GLFW_FALSE

GLFW_FLOATING 	GLFW_FALSE 	GLFW_TRUE or GLFW_FALSE

GLFW_MAXIMIZED 	GLFW_FALSE 	GLFW_TRUE or GLFW_FALSE

GLFW_RED_BITS 	8 	0 to INT_MAX or GLFW_DONT_CARE

GLFW_GREEN_BITS 	8 	0 to INT_MAX or GLFW_DONT_CARE

GLFW_BLUE_BITS 	8 	0 to INT_MAX or GLFW_DONT_CARE

GLFW_ALPHA_BITS 	8 	0 to INT_MAX or GLFW_DONT_CARE

GLFW_DEPTH_BITS 	24 	0 to INT_MAX or GLFW_DONT_CARE

GLFW_STENCIL_BITS 	8 	0 to INT_MAX or GLFW_DONT_CARE

GLFW_ACCUM_RED_BITS 	0 	0 to INT_MAX or GLFW_DONT_CARE

GLFW_ACCUM_GREEN_BITS 	0 	0 to INT_MAX or GLFW_DONT_CARE

GLFW_ACCUM_BLUE_BITS 	0 	0 to INT_MAX or GLFW_DONT_CARE

GLFW_ACCUM_ALPHA_BITS 	0 	0 to INT_MAX or GLFW_DONT_CARE

GLFW_AUX_BUFFERS 	0 	0 to INT_MAX or GLFW_DONT_CARE

GLFW_SAMPLES 	0 	0 to INT_MAX or GLFW_DONT_CARE

GLFW_REFRESH_RATE 	GLFW_DONT_CARE 	0 to INT_MAX or GLFW_DONT_CARE

GLFW_STEREO 	GLFW_FALSE 	GLFW_TRUE or GLFW_FALSE

GLFW_SRGB_CAPABLE 	GLFW_FALSE 	GLFW_TRUE or GLFW_FALSE

GLFW_DOUBLEBUFFER 	GLFW_TRUE 	GLFW_TRUE or GLFW_FALSE

GLFW_CLIENT_API 	GLFW_OPENGL_API 	GLFW_OPENGL_API, GLFW_OPENGL_ES_API or GLFW_NO_API

GLFW_CONTEXT_CREATION_API 	GLFW_NATIVE_CONTEXT_API 	GLFW_NATIVE_CONTEXT_API or GLFW_EGL_CONTEXT_API

GLFW_CONTEXT_VERSION_MAJOR 	1 	Any valid major version number of the chosen client API

GLFW_CONTEXT_VERSION_MINOR 	0 	Any valid minor version number of the chosen client API

GLFW_CONTEXT_ROBUSTNESS 	GLFW_NO_ROBUSTNESS 	GLFW_NO_ROBUSTNESS, GLFW_NO_RESET_NOTIFICATION or GLFW_LOSE_CONTEXT_ON_RESET

GLFW_CONTEXT_RELEASE_BEHAVIOR 	GLFW_ANY_RELEASE_BEHAVIOR 	GLFW_ANY_RELEASE_BEHAVIOR, GLFW_RELEASE_BEHAVIOR_FLUSH or GLFW_RELEASE_BEHAVIOR_NONE

GLFW_OPENGL_FORWARD_COMPAT 	GLFW_FALSE 	GLFW_TRUE or GLFW_FALSE

GLFW_OPENGL_DEBUG_CONTEXT 	GLFW_FALSE 	GLFW_TRUE or GLFW_FALSE

GLFW_OPENGL_PROFILE 	GLFW_OPENGL_ANY_PROFILE 	GLFW_OPENGL_ANY_PROFILE, GLFW_OPENGL_COMPAT_PROFILE or GLFW_OPENGL_CORE_PROFILE

Window event processing

See Event processing.

Window properties and events

User pointer

Each window has a user pointer that can be set with glfwSetWindowUserPointer and fetched with glfwGetWindowUserPointer. This can be used for any purpose you need and will not be modified by GLFW throughout the life-time of the window.

The initial value of the pointer is NULL.

Window closing and close flag

When the user attempts to close the window, for example by clicking the close widget or using a key chord like Alt+F4, the close flag of the window is set. The window is however not actually destroyed and, unless you watch for this state change, nothing further happens.

The current state of the close flag is returned by glfwWindowShouldClose and can be set or cleared directly with glfwSetWindowShouldClose. A common pattern is to use the close flag as a main loop condition.

while (!glfwWindowShouldClose(window))

{

    render(window);

    glfwSwapBuffers(window);

    glfwPollEvents();

}

If you wish to be notified when the user attempts to close a window, set a close callback.

glfwSetWindowCloseCallback(window, window_close_callback);

The callback function is called directly after the close flag has been set. It can be used for example to filter close requests and clear the close flag again unless certain conditions are met.

void window_close_callback(GLFWwindow* window)

{

    if (!time_to_close)

        glfwSetWindowShouldClose(window, GLFW_FALSE);

}

Window size

The size of a window can be changed with glfwSetWindowSize. For windowed mode windows, this sets the size, in screen coordinates of the client area or content area of the window. The window system may impose limits on window size.

glfwSetWindowSize(window, 640, 480);

For full screen windows, the specified size becomes the new resolution of the window's desired video mode. The video mode most closely matching the new desired video mode is set immediately. The window is resized to fit the resolution of the set video mode.

If you wish to be notified when a window is resized, whether by the user or the system, set a size callback.

glfwSetWindowSizeCallback(window, window_size_callback);

The callback function receives the new size, in screen coordinates, of the client area of the window when it is resized.

void window_size_callback(GLFWwindow* window, int width, int height)

{

}

There is also glfwGetWindowSize for directly retrieving the current size of a window.

int width, height;

glfwGetWindowSize(window, &width, &height);

Note

Do not pass the window size to glViewport or other pixel-based OpenGL calls. The window size is in screen coordinates, not pixels. Use the framebuffer size, which is in pixels, for pixel-based calls.

The above functions work with the size of the client area, but decorated windows typically have title bars and window frames around this rectangle. You can retrieve the extents of these with glfwGetWindowFrameSize.

int left, top, right, bottom;

glfwGetWindowFrameSize(window, &left, &top, &right, &bottom);

The returned values are the distances, in screen coordinates, from the edges of the client area to the corresponding edges of the full window. As they are distances and not coordinates, they are always zero or positive.

Framebuffer size

While the size of a window is measured in screen coordinates, OpenGL works with pixels. The size you pass into glViewport, for example, should be in pixels. On some machines screen coordinates and pixels are the same, but on others they will not be. There is a second set of functions to retrieve the size, in pixels, of the framebuffer of a window.

If you wish to be notified when the framebuffer of a window is resized, whether by the user or the system, set a size callback.

glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);

The callback function receives the new size of the framebuffer when it is resized, which can for example be used to update the OpenGL viewport.

void framebuffer_size_callback(GLFWwindow* window, int width, int height)

{

    glViewport(0, 0, width, height);

}

There is also glfwGetFramebufferSize for directly retrieving the current size of the framebuffer of a window.

int width, height;

glfwGetFramebufferSize(window, &width, &height);

glViewport(0, 0, width, height);

The size of a framebuffer may change independently of the size of a window, for example if the window is dragged between a regular monitor and a high-DPI one.

Window size limits

The minimum and maximum size of the client area of a windowed mode window can be enforced with glfwSetWindowSizeLimits. The user may resize the window to any size and aspect ratio within the specified limits, unless the aspect ratio is also set.

glfwSetWindowSizeLimits(window, 200, 200, 400, 400);

To specify only a minimum size or only a maximum one, set the other pair to GLFW_DONT_CARE.

glfwSetWindowSizeLimits(window, 640, 480, GLFW_DONT_CARE, GLFW_DONT_CARE);

To disable size limits for a window, set them all to GLFW_DONT_CARE.

The aspect ratio of the client area of a windowed mode window can be enforced with glfwSetWindowAspectRatio. The user may resize the window freely unless size limits are also set, but the size will be constrained to maintain the aspect ratio.

glfwSetWindowAspectRatio(window, 16, 9);

The aspect ratio is specified as a numerator and denominator, corresponding to the width and height, respectively. If you want a window to maintain its current aspect ratio, simply use its current size as the ratio.

int width, height;

glfwGetWindowSize(window, &width, &height);

glfwSetWindowAspectRatio(window, width, height);

To disable the aspect ratio limit for a window, set both terms to GLFW_DONT_CARE.

You can have both size limits and aspect ratio set for a window, but the results are undefined if they conflict.

Window position

The position of a windowed-mode window can be changed with glfwSetWindowPos. This moves the window so that the upper-left corner of its client area has the specified screen coordinates. The window system may put limitations on window placement.

glfwSetWindowPos(window, 100, 100);

If you wish to be notified when a window is moved, whether by the user, system or your own code, set a position callback.

glfwSetWindowPosCallback(window, window_pos_callback);

The callback function receives the new position of the upper-left corner of the client area when the window is moved.

void window_pos_callback(GLFWwindow* window, int xpos, int ypos)

{

}

There is also glfwGetWindowPos for directly retrieving the current position of the client area of the window.

int xpos, ypos;

glfwGetWindowPos(window, &xpos, &ypos);

Window title

All GLFW windows have a title, although undecorated or full screen windows may not display it or only display it in a task bar or similar interface. You can set a UTF-8 encoded window title with glfwSetWindowTitle.

glfwSetWindowTitle(window, "My Window");

The specified string is copied before the function returns, so there is no need to keep it around.

As long as your source file is encoded as UTF-8, you can use any Unicode characters directly in the source.

glfwSetWindowTitle(window, "カウボーイビバップ");

If you are using C++11 or C11, you can use a UTF-8 string literal.

glfwSetWindowTitle(window, u8"This is always a UTF-8 string");

Window icon

Decorated windows have icons on some platforms. You can set this icon by specifying a list of candidate images with glfwSetWindowIcon.

GLFWimage images[2];

images[0] = load_icon("my_icon.png");

images[1] = load_icon("my_icon_small.png");

glfwSetWindowIcon(window, 2, images);

To revert to the default window icon, pass in an empty image array.

glfwSetWindowIcon(window, 0, NULL);

Window monitor

Full screen windows are associated with a specific monitor. You can get the handle for this monitor with glfwGetWindowMonitor.

GLFWmonitor* monitor = glfwGetWindowMonitor(window);

This monitor handle is one of those returned by glfwGetMonitors.

For windowed mode windows, this function returns NULL. This is how to tell full screen windows from windowed mode windows.

You can move windows between monitors or between full screen and windowed mode with glfwSetWindowMonitor. When making a window full screen on the same or on a different monitor, specify the desired monitor, resolution and refresh rate. The position arguments are ignored.

const GLFWvidmode* mode = glfwGetVideoMode(monitor);

glfwSetWindowMonitor(window, monitor, 0, 0, mode->width, mode->height, mode->refreshRate);

When making the window windowed, specify the desired position and size. The refresh rate argument is ignored.

glfwSetWindowMonitor(window, NULL, xpos, ypos, width, height, 0);

This restores any previous window settings such as whether it is decorated, floating, resizable, has size or aspect ratio limits, etc.. To restore a window that was originally windowed to its original size and position, save these before making it full screen and then pass them in as above.

Window iconification

Windows can be iconified (i.e. minimized) with glfwIconifyWindow.

glfwIconifyWindow(window);

When a full screen window is iconified, the original video mode of its monitor is restored until the user or application restores the window.

Iconified windows can be restored with glfwRestoreWindow.

glfwRestoreWindow(window);

When a full screen window is restored, the desired video mode is restored to its monitor as well.

If you wish to be notified when a window is iconified or restored, whether by the user, system or your own code, set a iconify callback.

glfwSetWindowIconifyCallback(window, window_iconify_callback);

The callback function receives changes in the iconification state of the window.

void window_iconify_callback(GLFWwindow* window, int iconified)

{

    if (iconified)

    {

        // The window was iconified

    }

    else

    {

        // The window was restored

    }

}

You can also get the current iconification state with glfwGetWindowAttrib.

int iconified = glfwGetWindowAttrib(window, GLFW_ICONIFIED);

Window visibility

Windowed mode windows can be hidden with glfwHideWindow.

glfwHideWindow(window);

This makes the window completely invisible to the user, including removing it from the task bar, dock or window list. Full screen windows cannot be hidden and calling glfwHideWindow on a full screen window does nothing.

Hidden windows can be shown with glfwShowWindow.

glfwShowWindow(window);

Windowed mode windows can be created initially hidden with the GLFW_VISIBLE window hint. Windows created hidden are completely invisible to the user until shown. This can be useful if you need to set up your window further before showing it, for example moving it to a specific location.

You can also get the current visibility state with glfwGetWindowAttrib.

int visible = glfwGetWindowAttrib(window, GLFW_VISIBLE);

Window input focus

Windows can be given input focus and brought to the front with glfwFocusWindow.

glfwFocusWindow(window);

If you wish to be notified when a window gains or loses input focus, whether by the user, system or your own code, set a focus callback.

glfwSetWindowFocusCallback(window, window_focus_callback);

The callback function receives changes in the input focus state of the window.

void window_focus_callback(GLFWwindow* window, int focused)

{

    if (focused)

    {

        // The window gained input focus

    }

    else

    {

        // The window lost input focus

    }

}

You can also get the current input focus state with glfwGetWindowAttrib.

int focused = glfwGetWindowAttrib(window, GLFW_FOCUSED);

Window damage and refresh

If you wish to be notified when the contents of a window is damaged and needs to be refreshed, set a window refresh callback.

glfwSetWindowRefreshCallback(m_handle, window_refresh_callback);

The callback function is called when the contents of the window needs to be refreshed.

void window_refresh_callback(GLFWwindow* window)

{

    draw_editor_ui(window);

    glfwSwapBuffers(window);

}

Note

On compositing window systems such as Aero, Compiz or Aqua, where the window contents are saved off-screen, this callback might only be called when the window or framebuffer is resized.

Window attributes

Windows have a number of attributes that can be returned using glfwGetWindowAttrib. Some reflect state that may change during the lifetime of the window, while others reflect the corresponding hints and are fixed at the time of creation. Some are related to the actual window and others to its context.

if (glfwGetWindowAttrib(window, GLFW_FOCUSED))

{

    // window has input focus

}

Window related attributes

GLFW_FOCUSED indicates whether the specified window has input focus. Initial input focus is controlled by the window hint with the same name.

GLFW_ICONIFIED indicates whether the specified window is iconified, whether by the user or with glfwIconifyWindow.

GLFW_MAXIMIZED indicates whether the specified window is maximized, whether by the user or with glfwMaximizeWindow.

GLFW_VISIBLE indicates whether the specified window is visible. Window visibility can be controlled with glfwShowWindow and glfwHideWindow and initial visibility is controlled by the window hint with the same name.

GLFW_RESIZABLE indicates whether the specified window is resizable by the user. This is set on creation with the window hint with the same name.

GLFW_DECORATED indicates whether the specified window has decorations such as a border, a close widget, etc. This is set on creation with the window hint with the same name.

GLFW_FLOATING indicates whether the specified window is floating, also called topmost or always-on-top. This is controlled by the window hint with the same name.

Context related attributes

GLFW_CLIENT_API indicates the client API provided by the window's context; either GLFW_OPENGL_API, GLFW_OPENGL_ES_API or GLFW_NO_API.

GLFW_CONTEXT_CREATION_API indicates the context creation API used to create the window's context; either GLFW_NATIVE_CONTEXT_API or GLFW_EGL_CONTEXT_API.

GLFW_CONTEXT_VERSION_MAJOR, GLFW_CONTEXT_VERSION_MINOR and GLFW_CONTEXT_REVISION indicate the client API version of the window's context.

GLFW_OPENGL_FORWARD_COMPAT is GLFW_TRUE if the window's context is an OpenGL forward-compatible one, or GLFW_FALSE otherwise.

GLFW_OPENGL_DEBUG_CONTEXT is GLFW_TRUE if the window's context is an OpenGL debug context, or GLFW_FALSE otherwise.

GLFW_OPENGL_PROFILE indicates the OpenGL profile used by the context. This is GLFW_OPENGL_CORE_PROFILE or GLFW_OPENGL_COMPAT_PROFILE if the context uses a known profile, or GLFW_OPENGL_ANY_PROFILE if the OpenGL profile is unknown or the context is an OpenGL ES context. Note that the returned profile may not match the profile bits of the context flags, as GLFW will try other means of detecting the profile when no bits are set.

GLFW_CONTEXT_ROBUSTNESS indicates the robustness strategy used by the context. This is GLFW_LOSE_CONTEXT_ON_RESET or GLFW_NO_RESET_NOTIFICATION if the window's context supports robustness, or GLFW_NO_ROBUSTNESS otherwise.

Framebuffer related attributes

GLFW does not expose attributes of the default framebuffer (i.e. the framebuffer attached to the window) as these can be queried directly with either OpenGL, OpenGL ES or Vulkan.

If you are using version 3.0 or later of OpenGL or OpenGL ES, the glGetFramebufferAttachmentParameteriv function can be used to retrieve the number of bits for the red, green, blue, alpha, depth and stencil buffer channels. Otherwise, the glGetIntegerv function can be used.

The number of MSAA samples are always retrieved with glGetIntegerv. For contexts supporting framebuffer objects, the number of samples of the currently bound framebuffer is returned.

Attribute 	glGetIntegerv 	glGetFramebufferAttachmentParameteriv

Red bits 	GL_RED_BITS 	GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE

Green bits 	GL_GREEN_BITS 	GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE

Blue bits 	GL_BLUE_BITS 	GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE

Alpha bits 	GL_ALPHA_BITS 	GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE

Depth bits 	GL_DEPTH_BITS 	GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE

Stencil bits 	GL_STENCIL_BITS 	GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE

MSAA samples 	GL_SAMPLES 	Not provided by this function

When calling glGetFramebufferAttachmentParameteriv, the red, green, blue and alpha sizes are queried from the GL_BACK_LEFT, while the depth and stencil sizes are queried from the GL_DEPTH and GL_STENCIL attachments, respectively.

Buffer swapping

GLFW windows are by default double buffered. That means that you have two rendering buffers; a front buffer and a back buffer. The front buffer is the one being displayed and the back buffer the one you render to.

When the entire frame has been rendered, it is time to swap the back and the front buffers in order to display what has been rendered and begin rendering a new frame. This is done with glfwSwapBuffers.

glfwSwapBuffers(window);

Sometimes it can be useful to select when the buffer swap will occur. With the function glfwSwapInterval it is possible to select the minimum number of monitor refreshes the driver wait should from the time glfwSwapBuffers was called before swapping the buffers:

glfwSwapInterval(1);

If the interval is zero, the swap will take place immediately when glfwSwapBuffers is called without waiting for a refresh. Otherwise at least interval retraces will pass between each buffer swap. Using a swap interval of zero can be useful for benchmarking purposes, when it is not desirable to measure the time it takes to wait for the vertical retrace. However, a swap interval of one lets you avoid tearing.

Note that this may not work on all machines, as some drivers have user-controlled settings that override any swap interval the application requests.

<address class="footer">

Last update on Thu Aug 18 2016 for GLFW 3.2.1

</address>


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>GLFW: Getting started</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="extra.css" rel="stylesheet" type="text/css"/>

		GLFW

Documentation

Download

Media

Community

Main Page

Related Pages

Modules

Data Structures

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

Getting started

Table of Contents

Step by step

Including the GLFW header

Initializing and terminating GLFW

Setting an error callback

Creating a window and context

Making the OpenGL context current

Checking the window close flag

Receiving input events

Rendering with OpenGL

Reading the timer

Swapping buffers

Processing events

Putting it together

This guide takes you through writing a simple application using GLFW 3. The application will create a window and OpenGL context, render a rotating triangle and exit when the user closes the window or presses Escape. This guide will introduce a few of the most commonly used functions, but there are many more.

This guide assumes no experience with earlier versions of GLFW. If you have used GLFW 2 in the past, read Moving from GLFW 2 to 3, as some functions behave differently in GLFW 3.

Step by step

Including the GLFW header

In the source files of your application where you use OpenGL or GLFW, you need to include the GLFW 3 header file.

#include <GLFW/glfw3.h>

This defines all the constants, types and function prototypes of the GLFW API. It also includes the OpenGL header from your development environment and defines all the constants and types necessary for it to work on your platform without including any platform-specific headers.

In other words:

Do not include the OpenGL header yourself, as GLFW does this for you in a platform-independent way

Do not include windows.h or other platform-specific headers unless you plan on using those APIs yourself

If you do need to include such headers, include them before the GLFW header and it will detect this

On some platforms supported by GLFW the OpenGL header and link library only expose older versions of OpenGL. The most extreme case is Windows, which only exposes OpenGL 1.2. The easiest way to work around this is to use an extension loader library.

If you are using such a library then you should include its header before the GLFW header. This lets it replace the OpenGL header included by GLFW without conflicts. This example uses glad, but the same rule applies to all such libraries.

#include <glad/glad.h>

#include <GLFW/glfw3.h>

Initializing and terminating GLFW

Before you can use most GLFW functions, the library must be initialized. On successful initialization, GLFW_TRUE is returned. If an error occurred, GLFW_FALSE is returned.

if (!glfwInit())

{

    // Initialization failed

}

Note that GLFW_TRUE and GLFW_FALSE are and will always be just one and zero.

When you are done using GLFW, typically just before the application exits, you need to terminate GLFW.

glfwTerminate();

This destroys any remaining windows and releases any other resources allocated by GLFW. After this call, you must initialize GLFW again before using any GLFW functions that require it.

Setting an error callback

Most events are reported through callbacks, whether it's a key being pressed, a GLFW window being moved, or an error occurring. Callbacks are simply C functions (or C++ static methods) that are called by GLFW with arguments describing the event.

In case a GLFW function fails, an error is reported to the GLFW error callback. You can receive these reports with an error callback. This function must have the signature below. This simple error callback just prints the error description to stderr.

void error_callback(int error, const char* description)

{

    fprintf(stderr, "Error: %s\n", description);

}

Callback functions must be set, so GLFW knows to call them. The function to set the error callback is one of the few GLFW functions that may be called before initialization, which lets you be notified of errors both during and after initialization.

glfwSetErrorCallback(error_callback);

Creating a window and context

The window and its OpenGL context are created with a single call to glfwCreateWindow, which returns a handle to the created combined window and context object

GLFWwindow* window = glfwCreateWindow(640, 480, "My Title", NULL, NULL);

if (!window)

{

    // Window or OpenGL context creation failed

}

This creates a 640 by 480 windowed mode window with an OpenGL context. If window or OpenGL context creation fails, NULL will be returned. You should always check the return value. While window creation rarely fails, context creation depends on properly installed drivers and may fail even on machines with the necessary hardware.

By default, the OpenGL context GLFW creates may have any version. You can require a minimum OpenGL version by setting the GLFW_CONTEXT_VERSION_MAJOR and GLFW_CONTEXT_VERSION_MINOR hints before creation. If the required minimum version is not supported on the machine, context (and window) creation fails.

glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2);

glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);

GLFWwindow* window = glfwCreateWindow(640, 480, "My Title", NULL, NULL);

if (!window)

{

    // Window or context creation failed

}

The window handle is passed to all window related functions and is provided to along to all window related callbacks, so they can tell which window received the event.

When a window and context is no longer needed, destroy it.

glfwDestroyWindow(window);

Once this function is called, no more events will be delivered for that window and its handle becomes invalid.

Making the OpenGL context current

Before you can use the OpenGL API, you must have a current OpenGL context.

glfwMakeContextCurrent(window);

The context will remain current until you make another context current or until the window owning the current context is destroyed.

If you are using an extension loader library to access modern OpenGL then this is when to initialize it, as the loader needs a current context to load from. This example uses glad, but the same rule applies to all such libraries.

gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);

Checking the window close flag

Each window has a flag indicating whether the window should be closed.

When the user attempts to close the window, either by pressing the close widget in the title bar or using a key combination like Alt+F4, this flag is set to 1. Note that the window isn't actually closed, so you are expected to monitor this flag and either destroy the window or give some kind of feedback to the user.

while (!glfwWindowShouldClose(window))

{

    // Keep running

}

You can be notified when the user is attempting to close the window by setting a close callback with glfwSetWindowCloseCallback. The callback will be called immediately after the close flag has been set.

You can also set it yourself with glfwSetWindowShouldClose. This can be useful if you want to interpret other kinds of input as closing the window, like for example pressing the Escape key.

Receiving input events

Each window has a large number of callbacks that can be set to receive all the various kinds of events. To receive key press and release events, create a key callback function.

static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)

{

    if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)

        glfwSetWindowShouldClose(window, GLFW_TRUE);

}

The key callback, like other window related callbacks, are set per-window.

glfwSetKeyCallback(window, key_callback);

In order for event callbacks to be called when events occur, you need to process events as described below.

Rendering with OpenGL

Once you have a current OpenGL context, you can use OpenGL normally. In this tutorial, a multi-colored rotating triangle will be rendered. The framebuffer size needs to be retrieved for glViewport.

int width, height;

glfwGetFramebufferSize(window, &width, &height);

glViewport(0, 0, width, height);

You can also set a framebuffer size callback using glfwSetFramebufferSizeCallback and be notified when the size changes.

Actual rendering with OpenGL is outside the scope of this tutorial, but there are many excellent tutorial sites that teach modern OpenGL. Some of them use GLFW to create the context and window while others use GLUT or SDL, but remember that OpenGL itself always works the same.

Reading the timer

To create smooth animation, a time source is needed. GLFW provides a timer that returns the number of seconds since initialization. The time source used is the most accurate on each platform and generally has micro- or nanosecond resolution.

double time = glfwGetTime();

Swapping buffers

GLFW windows by default use double buffering. That means that each window has two rendering buffers; a front buffer and a back buffer. The front buffer is the one being displayed and the back buffer the one you render to.

When the entire frame has been rendered, the buffers need to be swapped with one another, so the back buffer becomes the front buffer and vice versa.

glfwSwapBuffers(window);

The swap interval indicates how many frames to wait until swapping the buffers, commonly known as vsync. By default, the swap interval is zero, meaning buffer swapping will occur immediately. On fast machines, many of those frames will never be seen, as the screen is still only updated typically 60-75 times per second, so this wastes a lot of CPU and GPU cycles.

Also, because the buffers will be swapped in the middle the screen update, leading to screen tearing.

For these reasons, applications will typically want to set the swap interval to one. It can be set to higher values, but this is usually not recommended, because of the input latency it leads to.

glfwSwapInterval(1);

This function acts on the current context and will fail unless a context is current.

Processing events

GLFW needs to communicate regularly with the window system both in order to receive events and to show that the application hasn't locked up. Event processing must be done regularly while you have visible windows and is normally done each frame after buffer swapping.

There are two methods for processing pending events; polling and waiting. This example will use event polling, which processes only those events that have already been received and then returns immediately.

glfwPollEvents();

This is the best choice when rendering continually, like most games do. If instead you only need to update your rendering once you have received new input, glfwWaitEvents is a better choice. It waits until at least one event has been received, putting the thread to sleep in the meantime, and then processes all received events. This saves a great deal of CPU cycles and is useful for, for example, many kinds of editing tools.

Putting it together

Now that you know how to initialize GLFW, create a window and poll for keyboard input, it's possible to create a simple program.

This program creates a 640 by 480 windowed mode window and starts a loop that clears the screen, renders a triangle and processes events until the user either presses Escape or closes the window.

#include <glad/glad.h>

#include <GLFW/glfw3.h>

#include "linmath.h"

#include <stdlib.h>

#include <stdio.h>

static const struct

{

    float x, y;

    float r, g, b;

} vertices[3] =

{

    { -0.6f, -0.4f, 1.f, 0.f, 0.f },

    {  0.6f, -0.4f, 0.f, 1.f, 0.f },

    {   0.f,  0.6f, 0.f, 0.f, 1.f }

};

static const char* vertex_shader_text =

"uniform mat4 MVP;\n"

"attribute vec3 vCol;\n"

"attribute vec2 vPos;\n"

"varying vec3 color;\n"

"void main()\n"

"{\n"

"    gl_Position = MVP * vec4(vPos, 0.0, 1.0);\n"

"    color = vCol;\n"

"}\n";

static const char* fragment_shader_text =

"varying vec3 color;\n"

"void main()\n"

"{\n"

"    gl_FragColor = vec4(color, 1.0);\n"

"}\n";

static void error_callback(int error, const char* description)

{

    fprintf(stderr, "Error: %s\n", description);

}

static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)

{

    if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)

        glfwSetWindowShouldClose(window, GLFW_TRUE);

}

int main(void)

{

    GLFWwindow* window;

    GLuint vertex_buffer, vertex_shader, fragment_shader, program;

    GLint mvp_location, vpos_location, vcol_location;

    glfwSetErrorCallback(error_callback);

    if (!glfwInit())

        exit(EXIT_FAILURE);

    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2);

    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);

    window = glfwCreateWindow(640, 480, "Simple example", NULL, NULL);

    if (!window)

    {

        glfwTerminate();

        exit(EXIT_FAILURE);

    }

    glfwSetKeyCallback(window, key_callback);

    glfwMakeContextCurrent(window);

    gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);

    glfwSwapInterval(1);

    // NOTE: OpenGL error checks have been omitted for brevity

    glGenBuffers(1, &vertex_buffer);

    glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer);

    glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);

    vertex_shader = glCreateShader(GL_VERTEX_SHADER);

    glShaderSource(vertex_shader, 1, &vertex_shader_text, NULL);

    glCompileShader(vertex_shader);

    fragment_shader = glCreateShader(GL_FRAGMENT_SHADER);

    glShaderSource(fragment_shader, 1, &fragment_shader_text, NULL);

    glCompileShader(fragment_shader);

    program = glCreateProgram();

    glAttachShader(program, vertex_shader);

    glAttachShader(program, fragment_shader);

    glLinkProgram(program);

    mvp_location = glGetUniformLocation(program, "MVP");

    vpos_location = glGetAttribLocation(program, "vPos");

    vcol_location = glGetAttribLocation(program, "vCol");

    glEnableVertexAttribArray(vpos_location);

    glVertexAttribPointer(vpos_location, 2, GL_FLOAT, GL_FALSE,

                          sizeof(float) * 5, (void*) 0);

    glEnableVertexAttribArray(vcol_location);

    glVertexAttribPointer(vcol_location, 3, GL_FLOAT, GL_FALSE,

                          sizeof(float) * 5, (void*) (sizeof(float) * 2));

    while (!glfwWindowShouldClose(window))

    {

        float ratio;

        int width, height;

        mat4x4 m, p, mvp;

        glfwGetFramebufferSize(window, &width, &height);

        ratio = width / (float) height;

        glViewport(0, 0, width, height);

        glClear(GL_COLOR_BUFFER_BIT);

        mat4x4_identity(m);

        mat4x4_rotate_Z(m, m, (float) glfwGetTime());

        mat4x4_ortho(p, -ratio, ratio, -1.f, 1.f, 1.f, -1.f);

        mat4x4_mul(mvp, p, m);

        glUseProgram(program);

        glUniformMatrix4fv(mvp_location, 1, GL_FALSE, (const GLfloat*) mvp);

        glDrawArrays(GL_TRIANGLES, 0, 3);

        glfwSwapBuffers(window);

        glfwPollEvents();

    }

    glfwDestroyWindow(window);

    glfwTerminate();

    exit(EXIT_SUCCESS);

}

 The program above can be found in the source package as examples/simple.c and is compiled along with all other examples when you build GLFW. If you built GLFW from the source package then already have this as simple.exe on Windows, simple on Linux or simple.app on OS X.

This tutorial used only a few of the many functions GLFW provides. There are guides for each of the areas covered by GLFW. Each guide will introduce all the functions for that category.

Introduction to the API

Window guide

Context guide

Monitor guide

Input guide

You can access reference documentation for any GLFW function by clicking it and the reference for each function links to related functions and guide sections.

The tutorial ends here. Once you have written a program that uses GLFW, you will need to compile and link it. How to do that depends on the development environment you are using and is best explained by the documentation for that environment. To learn about the details that are specific to GLFW, see Building applications.

<address class="footer">

Last update on Thu Aug 18 2016 for GLFW 3.2.1

</address>


text:
function toggleVisibility(linkObj)
{
 var base = $(linkObj).attr('id');
 var summary = $('#'+base+'-summary');
 var content = $('#'+base+'-content');
 var trigger = $('#'+base+'-trigger');
 var src=$(trigger).attr('src');
 if (content.is(':visible')===true) {
   content.hide();
   summary.show();
   $(linkObj).addClass('closed').removeClass('opened');
   $(trigger).attr('src',src.substring(0,src.length-8)+'closed.png');
 } else {
   content.show();
   summary.hide();
   $(linkObj).removeClass('closed').addClass('opened');
   $(trigger).attr('src',src.substring(0,src.length-10)+'open.png');
 }
 return false;
}

function updateStripes()
{
  $('table.directory tr').
       removeClass('even').filter(':visible:even').addClass('even');
}

function toggleLevel(level)
{
  $('table.directory tr').each(function() {
    var l = this.id.split('_').length-1;
    var i = $('#img'+this.id.substring(3));
    var a = $('#arr'+this.id.substring(3));
    if (l<level+1) {
      i.removeClass('iconfopen iconfclosed').addClass('iconfopen');
      a.html('▼');
      $(this).show();
    } else if (l==level+1) {
      i.removeClass('iconfclosed iconfopen').addClass('iconfclosed');
      a.html('►');
      $(this).show();
    } else {
      $(this).hide();
    }
  });
  updateStripes();
}

function toggleFolder(id)
{
  // the clicked row
  var currentRow = $('#row_'+id);

  // all rows after the clicked row
  var rows = currentRow.nextAll("tr");

  var re = new RegExp('^row_'+id+'\\d+_$', "i"); //only one sub

  // only match elements AFTER this one (can't hide elements before)
  var childRows = rows.filter(function() { return this.id.match(re); });

  // first row is visible we are HIDING
  if (childRows.filter(':first').is(':visible')===true) {
    // replace down arrow by right arrow for current row
    var currentRowSpans = currentRow.find("span");
    currentRowSpans.filter(".iconfopen").removeClass("iconfopen").addClass("iconfclosed");
    currentRowSpans.filter(".arrow").html('►');
    rows.filter("[id^=row_"+id+"]").hide(); // hide all children
  } else { // we are SHOWING
    // replace right arrow by down arrow for current row
    var currentRowSpans = currentRow.find("span");
    currentRowSpans.filter(".iconfclosed").removeClass("iconfclosed").addClass("iconfopen");
    currentRowSpans.filter(".arrow").html('▼');
    // replace down arrows by right arrows for child rows
    var childRowsSpans = childRows.find("span");
    childRowsSpans.filter(".iconfopen").removeClass("iconfopen").addClass("iconfclosed");
    childRowsSpans.filter(".arrow").html('►');
    childRows.show(); //show all children
  }
  updateStripes();
}

function toggleInherit(id)
{
  var rows = $('tr.inherit.'+id);
  var img = $('tr.inherit_header.'+id+' img');
  var src = $(img).attr('src');
  if (rows.filter(':first').is(':visible')===true) {
    rows.css('display','none');
    $(img).attr('src',src.substring(0,src.length-8)+'closed.png');
  } else {
    rows.css('display','table-row'); // using show() causes jump in firefox
    $(img).attr('src',src.substring(0,src.length-10)+'open.png');
  }
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>GLFW: Globals</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="extra.css" rel="stylesheet" type="text/css"/>

		GLFW

Documentation

Download

Media

Community

Main Page

Related Pages

Modules

Data Structures

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

File List

Globals

All

Functions

Typedefs

Macros

a

b

c

d

e

f

g

h

i

j

k

l

m

n

o

p

r

s

t

v

w

Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- d -

GLFW_DECORATED
: glfw3.h

GLFW_DEPTH_BITS
: glfw3.h

GLFW_DISCONNECTED
: glfw3.h

GLFW_DONT_CARE
: glfw3.h

GLFW_DOUBLEBUFFER
: glfw3.h

glfwDefaultWindowHints()
: glfw3.h

glfwDestroyCursor()
: glfw3.h

glfwDestroyWindow()
: glfw3.h

<address class="footer">

Last update on Thu Aug 18 2016 for GLFW 3.2.1

</address>


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>GLFW: Globals</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="extra.css" rel="stylesheet" type="text/css"/>

		GLFW

Documentation

Download

Media

Community

Main Page

Related Pages

Modules

Data Structures

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

File List

Globals

All

Functions

Typedefs

Macros

a

b

c

d

e

f

g

h

i

j

k

l

m

n

o

p

r

s

t

v

- g -

GLFW_GREEN_BITS
: glfw3.h

<address class="footer">

Last update on Thu Aug 18 2016 for GLFW 3.2.1

</address>


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>GLFW: Globals</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="extra.css" rel="stylesheet" type="text/css"/>

		GLFW

Documentation

Download

Media

Community

Main Page

Related Pages

Modules

Data Structures

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

File List

Globals

All

Functions

Typedefs

Macros

a

b

c

d

e

f

g

h

i

j

k

l

m

n

o

p

r

s

t

v

w

Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- p -

GLFW_PLATFORM_ERROR
: glfw3.h

GLFW_PRESS
: glfw3.h

glfwPollEvents()
: glfw3.h

glfwPostEmptyEvent()
: glfw3.h

<address class="footer">

Last update on Thu Aug 18 2016 for GLFW 3.2.1

</address>


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>GLFW: Globals</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="extra.css" rel="stylesheet" type="text/css"/>

		GLFW

Documentation

Download

Media

Community

Main Page

Related Pages

Modules

Data Structures

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

File List

Globals

All

Functions

Typedefs

Macros

a

b

c

d

e

f

g

h

i

j

k

l

m

n

o

p

r

s

t

v

w

Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- l -

GLFW_LOSE_CONTEXT_ON_RESET
: glfw3.h

<address class="footer">

Last update on Thu Aug 18 2016 for GLFW 3.2.1

</address>


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>GLFW: Globals</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="extra.css" rel="stylesheet" type="text/css"/>

		GLFW

Documentation

Download

Media

Community

Main Page

Related Pages

Modules

Data Structures

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

File List

Globals

All

Functions

Typedefs

Macros

a

b

c

d

e

f

g

h

i

j

k

l

m

n

o

p

r

s

t

v

- m -

GLFW_MAXIMIZED
: glfw3.h

GLFW_MOD_ALT
: glfw3.h

GLFW_MOD_CONTROL
: glfw3.h

GLFW_MOD_SHIFT
: glfw3.h

GLFW_MOD_SUPER
: glfw3.h

GLFW_MOUSE_BUTTON_1
: glfw3.h

GLFW_MOUSE_BUTTON_2
: glfw3.h

GLFW_MOUSE_BUTTON_3
: glfw3.h

GLFW_MOUSE_BUTTON_4
: glfw3.h

GLFW_MOUSE_BUTTON_5
: glfw3.h

GLFW_MOUSE_BUTTON_6
: glfw3.h

GLFW_MOUSE_BUTTON_7
: glfw3.h

GLFW_MOUSE_BUTTON_8
: glfw3.h

GLFW_MOUSE_BUTTON_LAST
: glfw3.h

GLFW_MOUSE_BUTTON_LEFT
: glfw3.h

GLFW_MOUSE_BUTTON_MIDDLE
: glfw3.h

GLFW_MOUSE_BUTTON_RIGHT
: glfw3.h

<address class="footer">

Last update on Thu Aug 18 2016 for GLFW 3.2.1

</address>


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>GLFW: Globals</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="extra.css" rel="stylesheet" type="text/css"/>

		GLFW

Documentation

Download

Media

Community

Main Page

Related Pages

Modules

Data Structures

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

File List

Globals

All

Functions

Typedefs

Macros

a

b

c

d

e

f

g

h

i

j

k

l

m

n

o

p

r

s

t

v

- i -

GLFW_IBEAM_CURSOR
: glfw3.h

GLFW_ICONIFIED
: glfw3.h

GLFW_INVALID_ENUM
: glfw3.h

GLFW_INVALID_VALUE
: glfw3.h

<address class="footer">

Last update on Thu Aug 18 2016 for GLFW 3.2.1

</address>


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>GLFW: Globals</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="extra.css" rel="stylesheet" type="text/css"/>

		GLFW

Documentation

Download

Media

Community

Main Page

Related Pages

Modules

Data Structures

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

File List

Globals

All

Functions

Typedefs

Macros

a

b

c

d

e

f

g

h

i

j

k

l

m

n

o

p

r

s

t

v

w

Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- o -

GLFW_OPENGL_ANY_PROFILE
: glfw3.h

GLFW_OPENGL_API
: glfw3.h

GLFW_OPENGL_COMPAT_PROFILE
: glfw3.h

GLFW_OPENGL_CORE_PROFILE
: glfw3.h

GLFW_OPENGL_DEBUG_CONTEXT
: glfw3.h

GLFW_OPENGL_ES_API
: glfw3.h

GLFW_OPENGL_FORWARD_COMPAT
: glfw3.h

GLFW_OPENGL_PROFILE
: glfw3.h

GLFW_OUT_OF_MEMORY
: glfw3.h

<address class="footer">

Last update on Thu Aug 18 2016 for GLFW 3.2.1

</address>


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>GLFW: glfw3native.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="extra.css" rel="stylesheet" type="text/css"/>

		GLFW

Documentation

Download

Media

Community

Main Page

Related Pages

Modules

Data Structures

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

File List

Globals

glfw-3.2.1

include

GLFW

Functions

glfw3native.h File Reference

The header of the native access functions.
More...

Go to the source code of this file.

Functions

const char * 	glfwGetWin32Adapter (GLFWmonitor *monitor)

 	Returns the adapter device name of the specified monitor.  More...

const char * 	glfwGetWin32Monitor (GLFWmonitor *monitor)

 	Returns the display device name of the specified monitor.  More...

HWND 	glfwGetWin32Window (GLFWwindow *window)

 	Returns the HWND of the specified window.  More...

HGLRC 	glfwGetWGLContext (GLFWwindow *window)

 	Returns the HGLRC of the specified window.  More...

CGDirectDisplayID 	glfwGetCocoaMonitor (GLFWmonitor *monitor)

 	Returns the CGDirectDisplayID of the specified monitor.  More...

id 	glfwGetCocoaWindow (GLFWwindow *window)

 	Returns the NSWindow of the specified window.  More...

id 	glfwGetNSGLContext (GLFWwindow *window)

 	Returns the NSOpenGLContext of the specified window.  More...

Display * 	glfwGetX11Display (void)

 	Returns the Display used by GLFW.  More...

RRCrtc 	glfwGetX11Adapter (GLFWmonitor *monitor)

 	Returns the RRCrtc of the specified monitor.  More...

RROutput 	glfwGetX11Monitor (GLFWmonitor *monitor)

 	Returns the RROutput of the specified monitor.  More...

Window 	glfwGetX11Window (GLFWwindow *window)

 	Returns the Window of the specified window.  More...

GLXContext 	glfwGetGLXContext (GLFWwindow *window)

 	Returns the GLXContext of the specified window.  More...

GLXWindow 	glfwGetGLXWindow (GLFWwindow *window)

 	Returns the GLXWindow of the specified window.  More...

struct wl_display * 	glfwGetWaylandDisplay (void)

 	Returns the struct wl_display* used by GLFW.  More...

struct wl_output * 	glfwGetWaylandMonitor (GLFWmonitor *monitor)

 	Returns the struct wl_output* of the specified monitor.  More...

struct wl_surface * 	glfwGetWaylandWindow (GLFWwindow *window)

 	Returns the main struct wl_surface* of the specified window.  More...

MirConnection * 	glfwGetMirDisplay (void)

 	Returns the MirConnection* used by GLFW.  More...

int 	glfwGetMirMonitor (GLFWmonitor *monitor)

 	Returns the Mir output ID of the specified monitor.  More...

MirSurface * 	glfwGetMirWindow (GLFWwindow *window)

 	Returns the MirSurface* of the specified window.  More...

EGLDisplay 	glfwGetEGLDisplay (void)

 	Returns the EGLDisplay used by GLFW.  More...

EGLContext 	glfwGetEGLContext (GLFWwindow *window)

 	Returns the EGLContext of the specified window.  More...

EGLSurface 	glfwGetEGLSurface (GLFWwindow *window)

 	Returns the EGLSurface of the specified window.  More...

Detailed Description

This is the header file of the native access functions. See Native access for more information.

<address class="footer">

Last update on Thu Aug 18 2016 for GLFW 3.2.1

</address>


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>GLFW: Globals</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="extra.css" rel="stylesheet" type="text/css"/>

		GLFW

Documentation

Download

Media

Community

Main Page

Related Pages

Modules

Data Structures

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

File List

Globals

All

Functions

Typedefs

Macros

a

b

c

d

e

f

g

h

i

j

k

l

m

n

o

p

r

s

t

v

- o -

GLFW_OPENGL_ANY_PROFILE
: glfw3.h

GLFW_OPENGL_API
: glfw3.h

GLFW_OPENGL_COMPAT_PROFILE
: glfw3.h

GLFW_OPENGL_CORE_PROFILE
: glfw3.h

GLFW_OPENGL_DEBUG_CONTEXT
: glfw3.h

GLFW_OPENGL_ES_API
: glfw3.h

GLFW_OPENGL_FORWARD_COMPAT
: glfw3.h

GLFW_OPENGL_PROFILE
: glfw3.h

GLFW_OUT_OF_MEMORY
: glfw3.h

<address class="footer">

Last update on Thu Aug 18 2016 for GLFW 3.2.1

</address>


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>GLFW: context.dox File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="extra.css" rel="stylesheet" type="text/css"/>

		GLFW

Documentation

Download

Media

Community

Main Page

Related Pages

Modules

Data Structures

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

File List

Globals

context.dox File Reference

<address class="footer">

Last update on Thu Aug 18 2016 for GLFW 3.2.1

</address>