Tizen Native API
5.0
|
Provides a set of helper functions and macros to use GLES 3.0 with Evas GL.
This file redefines all the OpenGL-ES 2.0 and OpenGL-ES 3.0 functions as follow:
#define glFunction __evas_gl_glapi->glFunction
Extension functions can then be checked for existence simply by writing:
if (glExtensionFunction)
{
...
glExtensionFunction(...);
...
}
When using Elementary GLView, please include the header file Elementary_GL_Helpers.h instead.
This header file should be included when using Evas GL directly at a low level and with an OpenGL-ES 3.0 context only.
glFunctions
are now macros, which means that the Evas_GL_API struct can't be used anyore.Defines | |
#define | EVAS_GL_GLES3_USE(evasgl, context) Evas_GL_API *__evas_gl_glapi = evas_gl_context_api_get(evasgl, context); |
Macro to place at the beginning of any function using GLES 3.0 APIs. | |
#define | EVAS_GL_GLES3_USE_OR_RETURN(evasgl, context, retval) |
Macro to place at the beginning of any function using GLES 3.0 APIs. | |
#define | EVAS_GL_GLOBAL_GLES3_DECLARE() extern Evas_GL_API *__evas_gl_glapi; |
Convenience macro to use the GL helpers in simple applications: declare. | |
#define | EVAS_GL_GLOBAL_GLES3_DEFINE() Evas_GL_API *__evas_gl_glapi = NULL; |
Convenience macro to use the GL helpers in simple applications: define. | |
#define | EVAS_GL_GLOBAL_GLES3_USE(evgl, ctx) do { __evas_gl_glapi = evas_gl_context_api_get(evgl, ctx); } while (0) |
Convenience macro to use the GL helpers in simple applications: use. | |
#define | EVAS_GL_GLES3_API_CHECK() ((__evas_gl_glapi != NULL) && (__evas_gl_glapi->version == EVAS_GL_API_VERSION) && (glBeginQuery)) |
Macro to check that the GL APIs are properly set (GLES 3.0) |
#define EVAS_GL_GLES3_API_CHECK | ( | ) | ((__evas_gl_glapi != NULL) && (__evas_gl_glapi->version == EVAS_GL_API_VERSION) && (glBeginQuery)) |
Macro to check that the GL APIs are properly set (GLES 3.0)
#define EVAS_GL_GLES3_USE | ( | evasgl, | |
context | |||
) | Evas_GL_API *__evas_gl_glapi = evas_gl_context_api_get(evasgl, context); |
Macro to place at the beginning of any function using GLES 3.0 APIs.
Normally, it is necessary to call each function using its pointer as in:
glapi->glFunction();
When using this macro, developers can then call all glFunctions
without changing their code:
EVAS_GL_GLES3_USE(evasgl, context); // Add this at the beginning glFunction(); // All calls 'look' normal
#define EVAS_GL_GLES3_USE_OR_RETURN | ( | evasgl, | |
context, | |||
retval | |||
) |
Evas_GL_API *__evas_gl_glapi = evas_gl_context_api_get(evasgl, context); \ if (!__evas_gl_glapi) return retval;
Macro to place at the beginning of any function using GLES 3.0 APIs.
This is similar to EVAS_GL_GLES3_USE except that it will return from the function if the GL API can not be used.
#define EVAS_GL_GLOBAL_GLES3_DECLARE | ( | ) | extern Evas_GL_API *__evas_gl_glapi; |
Convenience macro to use the GL helpers in simple applications: declare.
EVAS_GL_GLOBAL_GLES3_DECLARE
should be used in a global header for the application. For example, in a platform-specific compatibility header file.
To be used with OpenGL-ES 3.0 contexts.
Example of a global header file main.h:
#include <Evas_GL_GLES3_Helpers.h> // other includes... EVAS_GL_GLOBAL_GLES3_DECLARE() // ...
#define EVAS_GL_GLOBAL_GLES3_DEFINE | ( | ) | Evas_GL_API *__evas_gl_glapi = NULL; |
Convenience macro to use the GL helpers in simple applications: define.
To be used with OpenGL-ES 3.0 contexts.
Example of a file glview.c:
#include "main.h" EVAS_GL_GLOBAL_GLES3_DEFINE() // ... static inline void evgl_init(...) { // ... evasgl = evas_gl_new(canvas); // ... ctx = evas_gl_context_version_create(evasgl, NULL, EVAS_GL_GLES_3_X); EVAS_GL_GLOBAL_GLES3_USE(evasgl, ctx); // ... } // ...
#define EVAS_GL_GLOBAL_GLES3_USE | ( | evgl, | |
ctx | |||
) | do { __evas_gl_glapi = evas_gl_context_api_get(evgl, ctx); } while (0) |
Convenience macro to use the GL helpers in simple applications: use.
This macro will set the global variable holding the GL API so that it's available to the application.
It should be used right after setting up the GL context object.