Tizen Native API
5.5
|
Provides a set of helper functions and macros to use GLES 1.1 with Evas GL.
This file redefines all the OpenGL-ES 1.1 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 1.1 context only.
glFunctions
are now macros, which means that the Evas_GL_API struct can't be used anyore.Defines | |
#define | EVAS_GL_GLES1_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 1.1 APIs. | |
#define | EVAS_GL_GLES1_USE_OR_RETURN(evasgl, context, retval) |
Macro to place at the beginning of any function using GLES 1.1 APIs. | |
#define | EVAS_GL_GLOBAL_GLES1_DECLARE() extern Evas_GL_API *__evas_gl_glapi; |
Convenience macro to use the GL helpers in simple applications: declare. | |
#define | EVAS_GL_GLOBAL_GLES1_DEFINE() Evas_GL_API *__evas_gl_glapi = NULL; |
Convenience macro to use the GL helpers in simple applications: define. | |
#define | EVAS_GL_GLOBAL_GLES1_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_GLES1_API_CHECK() ((__evas_gl_glapi != NULL) && (__evas_gl_glapi->version == EVAS_GL_API_VERSION) && (glAlphaFunc)) |
Macro to check that the GL APIs are properly set (GLES 1.1) |
#define EVAS_GL_GLES1_API_CHECK | ( | ) | ((__evas_gl_glapi != NULL) && (__evas_gl_glapi->version == EVAS_GL_API_VERSION) && (glAlphaFunc)) |
Macro to check that the GL APIs are properly set (GLES 1.1)
#define EVAS_GL_GLES1_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 1.1 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_GLES1_USE(evasgl, context); // Add this at the beginning glFunction(); // All calls 'look' normal
#define EVAS_GL_GLES1_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 1.1 APIs.
This is similar to EVAS_GL_GLES1_USE except that it will return from the function if the GL API can not be used.
#define EVAS_GL_GLOBAL_GLES1_DECLARE | ( | ) | extern Evas_GL_API *__evas_gl_glapi; |
Convenience macro to use the GL helpers in simple applications: declare.
EVAS_GL_GLOBAL_GLES1_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 1.1 contexts.
Example of a global header file main.h:
#include <Evas_GL_GLES1_Helpers.h> // other includes... EVAS_GL_GLOBAL_GLES1_DECLARE() // ...
#define EVAS_GL_GLOBAL_GLES1_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 1.1 contexts.
Example of a file glview.c:
#include "main.h" EVAS_GL_GLOBAL_GLES1_DEFINE() // ... static inline void evgl_init(...) { // ... evasgl = evas_gl_new(canvas); // ... ctx = evas_gl_context_version_create(evasgl, NULL, EVAS_GL_GLES_1_X); EVAS_GL_GLOBAL_GLES1_USE(evasgl, ctx); // ... } // ...
#define EVAS_GL_GLOBAL_GLES1_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.