GLFW 3.0.1 A multi-platform library for OpenGL, window and input

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

All Data Structures Files Functions Variables Typedefs Macros Groups Pages
Typedefs | Functions
Context handling

## Typedefs

typedef void(* | GLFWglproc )(void)
| Client API function pointer type. More...

## Functions

void | glfwMakeContextCurrent (GLFWwindow *window)
| Makes the context of the specified window current for the calling thread. More...
GLFWwindow * | glfwGetCurrentContext (void)
| Returns the window whose context is current on the calling thread. More...
void | glfwSwapBuffers (GLFWwindow *window)
| Swaps the front and back buffers of the specified window. More...
void | glfwSwapInterval (int interval)
| Sets the swap interval for the current context. More...
int | glfwExtensionSupported (const char *extension)
| Returns whether the specified extension is available. More...
GLFWglproc | glfwGetProcAddress (const char *procname)
| Returns the address of the specified function for the current context. More...

## Detailed Description

## Typedef Documentation

typedef void(* GLFWglproc)(void)

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

## Function Documentation

int glfwExtensionSupported | ( | const char * | extension | ) |

This function returns whether the specified OpenGL or context creation API extension is supported by the current context. For example, on Windows both the OpenGL and WGL extension strings are checked.

Parameters

  [in] | extension | The ASCII encoded name of the extension.

Returns
  `GL_TRUE` if the extension is available, or `GL_FALSE` otherwise.

Remarks
  This function may be called from secondary threads.

Note
  As this functions searches one or more extension strings on each call, it is recommended that you cache its results if it's going to be used frequently. The extension strings will not change during the lifetime of a context, so there is no danger in doing this.

GLFWwindow* glfwGetCurrentContext | ( | void |  | ) |

This function returns the window whose context is current on the calling thread.

Returns
  The window whose context is current, or `NULL` if no window's context is current.

Remarks
  This function may be called from secondary threads.

See Also
  glfwMakeContextCurrent

GLFWglproc glfwGetProcAddress | ( | const char * | procname | ) |

This function returns the address of the specified client API or extension function, if it is supported by the current context.

Parameters

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

Returns
  The address of the function, or `NULL` if the function is unavailable.

Remarks
  This function may be called from secondary threads.

Note
  The addresses of these functions are not guaranteed to be the same for all contexts, especially if they use different client APIs or even different context creation hints.

void glfwMakeContextCurrent | ( | GLFWwindow * | window | ) |

This function makes the context of the specified window current on the calling thread. A context can only be made current on a single thread at a time and each thread can have only a single current context at a time.

Parameters

  [in] | window | The window whose context to make current, or `NULL` to detach the current context.

Remarks
  This function may be called from secondary threads.

See Also
  glfwGetCurrentContext

void glfwSwapBuffers | ( | GLFWwindow * | window | ) |

This function swaps the front and back buffers of the specified window. If the swap interval is greater than zero, the GPU driver waits the specified number of screen updates before swapping the buffers.

Parameters

  [in] | window | The window whose buffers to swap.

Remarks
  This function may be called from secondary threads.

New in GLFW 3
  This function no longer calls glfwPollEvents. You need to call it or glfwWaitEvents yourself.

See Also
  glfwSwapInterval

void glfwSwapInterval | ( | int | interval | ) |

This function sets the swap interval for the current context, i.e. the number of screen updates to wait before swapping the buffers of a window and returning from glfwSwapBuffers. This is sometimes called 'vertical synchronization', 'vertical retrace synchronization' or 'vsync'.

Contexts that support either of the `WGL_EXT_swap_control_tear` and `GLX_EXT_swap_control_tear` extensions also accept negative swap intervals, which allow the driver to swap even if a frame arrives a little bit late. You can check for the presence of these extensions using glfwExtensionSupported. For more information about swap tearing, see the extension specifications.

Parameters

  [in] | interval | The minimum number of screen updates to wait for until the buffers are swapped by glfwSwapBuffers.

Remarks
  This function may be called from secondary threads.

Note
  Some GPU drivers do not honor the requested swap interval, either because of user settings that override the request or due to bugs in the driver.

See Also
  glfwSwapBuffers