Skip to main content
Version: 🚧 Nightly

Class f3d::context

Definition: context.h (line 24)

Utility function that implements basic OpenGL context symbol resolvers.

These functions should be used only when the rendering context (the OpenGL window) isn't managed by libf3d, but by the user directly. Therefore, the engine is created using f3d::engine::createExternal and the functions below can be used as argument of this factory. One can also create a custom functor returning a f3d::context::function.

Inner classes

Members

Public types

Typedef fptr

Definition: context.h (line 27)

using f3d::context::fptr =  void (*)()

Return type: void(*)()

Typedef function

Definition: context.h (line 28)

using f3d::context::function =  std::function<fptr(const char*)>

Return type: std::function< fptr(const char *)>

Public static functions

Function glx

static function f3d::context::glx()

Create a GLX context function. Only supported on Linux. Throw a loading_exception if it fails.

Return type: function

Function wgl

static function f3d::context::wgl()

Create a WGL context function. Only supported on Windows. Throw a loading_exception if it fails.

Return type: function

Function cocoa

static function f3d::context::cocoa()

Create a COCOA context function. This is usually required when using a headless context and a GPU device. Only supported on macOS. Throw a loading_exception if it fails.

Return type: function

Function egl

static function f3d::context::egl()

Create a EGL context function. This is usually required when using a headless context and a GPU device. Only supported on Linux and Windows. Throw a loading_exception if it fails.

Return type: function

Function osmesa

static function f3d::context::osmesa()

Create a OSMesa context function. This is usually required when using a headless context and no GPU device. Only supported on Linux and Windows. Throw a loading_exception if it fails.

Return type: function

Function getSymbol

static function f3d::context::getSymbol(std::string_view lib, std::string_view func)

Create a context function from a library name and a function name. The library name must be specified without its prefix and extension. For example, getSymbol("EGL", "eglGetProcAddress") looks for the symbol eglGetProcAddress in the library libEGL.so on Linux. Throw a loading_exception if it fails to find the library or a symbol_exception if the lib does not contains the expected symbol.

Parameters:

  • std::string_view lib
  • std::string_view func

Return type: function