Tizen Native API  6.0
Evas GL GLES1 helpers

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.

Note:
When this file is included, all glFunctions are now macros, which means that the Evas_GL_API struct can't be used anyore.
See also:
OpenGL with Elementary

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 Documentation

#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)

Since :
2.3.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
Note:
Please use ELEMENTARY_GLVIEW_USE() instead, when possible.
Since :
2.3.1
#define EVAS_GL_GLES1_USE_OR_RETURN (   evasgl,
  context,
  retval 
)
Value:
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.

Note:
Please use ELEMENTARY_GLVIEW_USE() instead, when possible.
Since :
2.3.1
#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()

// ...
Note:
Please use ELEMENTARY_GLVIEW_USE() instead, when possible.
See also:
ELEMENTARY_GLVIEW_GLOBAL_DECLARE
EVAS_GL_GLOBAL_GLES1_DEFINE
EVAS_GL_GLOBAL_GLES1_USE
Since :
2.3.1
#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);
   // ...
}

// ...
See also:
ELEMENTARY_GLVIEW_GLOBAL_DEFINE
EVAS_GL_GLOBAL_GLES1_DECLARE
EVAS_GL_GLOBAL_GLES1_USE
Since :
2.3.1
#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.

See also:
ELEMENTARY_GLVIEW_GLOBAL_USE
EVAS_GL_GLOBAL_GLES1_DECLARE
EVAS_GL_GLOBAL_GLES1_DEFINE
Since :
2.3.1