FastUIDraw
Classes | Functions
fastuidraw::gl_binding Namespace Reference

Provides interface for application to use GL where function pointers are auto-resolved transparently and under debug provides error checking. Built as a part of a seperate library; for GL it is libNGL; for GLES it is NGLES. The header defines for each GL/GLES function, glFoo, the macro fastuidraw_glFoo. More...

Classes

class  CallbackGL
 A CallbackGL defines the interface (via its base class) for callbacks before and after each GL call. More...
 

Functions

void * get_proc (c_string function)
 
void get_proc_function (void *(*get_proc)(c_string), bool fetch_functions=true)
 
void get_proc_function (void *datum, void *(*get_proc)(void *, c_string), bool fetch_functions=true)
 
void message (c_string message, c_string src_file, int src_line)
 

Detailed Description

Provides interface for application to use GL where function pointers are auto-resolved transparently and under debug provides error checking. Built as a part of a seperate library; for GL it is libNGL; for GLES it is NGLES. The header defines for each GL/GLES function, glFoo, the macro fastuidraw_glFoo.

Short version:

Long Version:

The namespace gl_binding provides an interface for an application to specify how to fetch GL function pointers (see fastuidraw::gl_binding::get_proc_function()) and additional functionality of where to write/store GL error messages. An application can also use this functionality by including <fastuidraw/gl_backend/ngl_header.hpp>. The header will create a macro fastuidraw_glFoo for each GL function glFoo. If FASTUIDRAW_DEBUG is defined, each GL call will be preceded by a callback and postceeded by another call back. The preceed callback to the GL call will call the implementation of CallbackGL::pre_call() of each active CallbackGL object. The post-process callback will repeatedly call glGetError (until it returns no error) to build an error-string. If the error string is non-empty, it is printed to stderr. In addition, regardless if the error-string is non-empty, CallbackGL::post_call() of each active CallbackGL is called.

The gl_binding system requires that an application provides a function which the binding system uses to fetch function pointers for the GL API, this is set via gl_binding::get_proc_function().

Lastly, before using a GL (or GLES) function, an application should check the GL implementation supports the named function by examining the GL version and/or extensions itself before using the function.

Function Documentation

◆ get_proc()

void* fastuidraw::gl_binding::get_proc ( c_string  function)

Fetches a GL function using the function fetcher passed to get_proc_function().

Parameters
functionname of function to fetch

◆ get_proc_function() [1/2]

void fastuidraw::gl_binding::get_proc_function ( void *(*)(c_string get_proc,
bool  fetch_functions = true 
)

Sets the function that the system uses to fetch the function pointers for GL or GLES.

Parameters
get_procvalue to use, default is nullptr.
fetch_functionsif true, fetch all GL functions immediately instead of fetching on first call.

◆ get_proc_function() [2/2]

void fastuidraw::gl_binding::get_proc_function ( void *  datum,
void *(*)(void *, c_string get_proc,
bool  fetch_functions = true 
)

Sets the function that the system uses to fetch the function pointers for GL or GLES.

Parameters
datumdata pointer passed to get_proc when invoked
get_procvalue to use, default is nullptr.
fetch_functionsif true, fetch all GL functions immediately instead of fetching on first call.

◆ message()

void fastuidraw::gl_binding::message ( c_string  message,
c_string  src_file,
int  src_line 
)

Function that implements FASTUIDRAW_GL_MESSAGE