Functions
Initialization and version information

Functions

int glfwInit (void)
 Initializes the GLFW library. More...
 
void glfwTerminate (void)
 Terminates the GLFW library. More...
 
void glfwGetVersion (int *major, int *minor, int *rev)
 Retrieves the version of the GLFW library. More...
 
const char * glfwGetVersionString (void)
 Returns a string describing the compile-time configuration. More...
 

GLFW version macros

#define GLFW_VERSION_MAJOR   3
 The major version number of the GLFW library. More...
 
#define GLFW_VERSION_MINOR   0
 The minor version number of the GLFW library. More...
 
#define GLFW_VERSION_REVISION   4
 The revision number of the GLFW library. More...
 

Detailed Description

Macro Definition Documentation

◆ GLFW_VERSION_MAJOR

#define GLFW_VERSION_MAJOR   3

This is incremented when the API is changed in non-compatible ways.

◆ GLFW_VERSION_MINOR

#define GLFW_VERSION_MINOR   0

This is incremented when features are added to the API but it remains backward-compatible.

◆ GLFW_VERSION_REVISION

#define GLFW_VERSION_REVISION   4

This is incremented when a bug fix release is made that does not contain any API changes.

Function Documentation

◆ glfwGetVersion()

void glfwGetVersion ( int *  major,
int *  minor,
int *  rev 
)

This function retrieves the major, minor and revision numbers of the GLFW library. It is intended for when you are using GLFW as a shared library and want to ensure that you are using the minimum required version.

Parameters
[out]majorWhere to store the major version number, or NULL.
[out]minorWhere to store the minor version number, or NULL.
[out]revWhere to store the revision number, or NULL.
Remarks
This function may be called before glfwInit.
This function may be called from any thread.
See also
glfwGetVersionString

◆ glfwGetVersionString()

const char* glfwGetVersionString ( void  )

This function returns a static string generated at compile-time according to which configuration macros were defined. This is intended for use when submitting bug reports, to allow developers to see which code paths are enabled in a binary.

The format of the string is as follows:

  • The version of GLFW
  • The name of the window system API
  • The name of the context creation API
  • Any additional options or APIs

For example, when compiling GLFW 3.0 with MinGW using the Win32 and WGL back ends, the version string may look something like this:

3.0.0 Win32 WGL MinGW
Returns
The GLFW version string.
Remarks
This function may be called before glfwInit.
This function may be called from any thread.
See also
glfwGetVersion

◆ glfwInit()

int glfwInit ( void  )

This function initializes the GLFW library. Before most GLFW functions can be used, GLFW must be initialized, and before a program terminates GLFW should be terminated in order to free any resources allocated during or after initialization.

If this function fails, it calls glfwTerminate before returning. If it succeeds, you should call glfwTerminate before the program exits.

Additional calls to this function after successful initialization but before termination will succeed but will do nothing.

Returns
GL_TRUE if successful, or GL_FALSE if an error occurred.
New in GLFW 3
This function no longer registers glfwTerminate with atexit.
Note
This function may only be called from the main thread.
OS X: This function will change the current directory of the application to the Contents/Resources subdirectory of the application's bundle, if present.
See also
glfwTerminate

◆ glfwTerminate()

void glfwTerminate ( void  )

This function destroys all remaining windows, frees any allocated resources and sets the library to an uninitialized state. Once this is called, you must again call glfwInit successfully before you will be able to use most GLFW functions.

If GLFW has been successfully initialized, this function should be called before the program exits. If initialization fails, there is no need to call this function, as it is called by glfwInit before it returns failure.

Remarks
This function may be called before glfwInit.
Note
This function may only be called from the main thread.
Warning
No window's context may be current on another thread when this function is called.
See also
glfwInit