Context

Typedefs

typedef void (*sfGlFunctionPointer)(void)

Functions

sfContext *sfContext_create(void)

Create a new context.

This function activates the new context.

Returns:

New sfContext object

void sfContext_destroy(const sfContext *context)

Destroy a context.

Parameters:
  • context – Context to destroy

bool sfContext_isExtensionAvailable(const char *name)

Check whether a given OpenGL extension is available.

Parameters:
  • name – Name of the extension to check for

Returns:

True if available, false if unavailable

bool sfContext_setActive(sfContext *context, bool active)

Activate or deactivate explicitly a context.

Parameters:
  • context – Context object

  • active – true to activate, false to deactivate

Returns:

true on success, false on failure

sfGlFunctionPointer sfContext_getFunction(const char *name)

Get the address of an OpenGL function.

Parameters:
  • name – Name of the function to get the address of

Returns:

Address of the OpenGL function, 0 on failure

sfContextSettings sfContext_getSettings(const sfContext *context)

Get the settings of the context.

Note that these settings may be different than the ones passed to the constructor; they are indeed adjusted if the original settings are not directly supported by the system.

Parameters:
  • context – Context object

Returns:

Structure containing the settings

uint64_t sfContext_getActiveContextId(void)

Get the currently active context’s ID.

The context ID is used to identify contexts when managing unshareable OpenGL resources.

Returns:

The active context’s ID or 0 if no context is currently active