Tizen Native API
5.0
|
This group discusses the functions that are used to do OpenGL rendering on Evas. Evas allows you to use OpenGL to render to specially set up image objects (which act as render target surfaces). By default, Evas GL will use an OpenGL-ES 2.0 context and API set.
While it is possible to Evas and Ecore_Evas to create an OpenGL application, using these low-level APIs can be troublesome for most users. Before diving in Evas GL, please refer to the page OpenGL with Elementary.
Elementary GLView provides a set of helper functions in:
Similarly, two sets of helper functions are provided by Evas GL in the following header files:
This API is related with the following feature:
It is recommended to design feature related codes in your application for reliability.
You can check if a device supports the related features for this API by using System Information, thereby controlling the procedure of your application.
To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.
More details on featuring your application can be found from Feature List.
Functions | |
Evas_GL * | evas_gl_new (Evas *e) |
Creates a new Evas_GL object and returns a handle for GL rendering with the EFL. | |
void | evas_gl_free (Evas_GL *evas_gl) |
Frees an Evas_GL object. | |
Evas_GL_Config * | evas_gl_config_new (void) |
Allocates a new config object for the user to fill out. | |
void | evas_gl_config_free (Evas_GL_Config *cfg) |
Frees a config object created from evas_gl_config_new. | |
Evas_GL_Surface * | evas_gl_surface_create (Evas_GL *evas_gl, Evas_GL_Config *cfg, int w, int h) |
Creates and returns a new Evas_GL_Surface object for GL Rendering. | |
Evas_GL_Surface * | evas_gl_pbuffer_surface_create (Evas_GL *evas_gl, Evas_GL_Config *cfg, int w, int h, const int *attrib_list) |
Create a pixel buffer surface. | |
void | evas_gl_surface_destroy (Evas_GL *evas_gl, Evas_GL_Surface *surf) |
Destroys an Evas GL Surface. | |
Evas_GL_Context * | evas_gl_context_create (Evas_GL *evas_gl, Evas_GL_Context *share_ctx) |
Creates and returns a new Evas GL context object (OpenGL-ES 2.0). | |
Evas_GL_Context * | evas_gl_context_version_create (Evas_GL *evas_gl, Evas_GL_Context *share_ctx, Evas_GL_Context_Version version) |
Creates and returns a new Evas GL context object for OpenGL-ES 1.1 or 2.0. | |
void | evas_gl_context_destroy (Evas_GL *evas_gl, Evas_GL_Context *ctx) |
Destroys the given Evas GL context object. | |
Eina_Bool | evas_gl_make_current (Evas_GL *evas_gl, Evas_GL_Surface *surf, Evas_GL_Context *ctx) |
Sets the given context as the current context for the given surface. | |
const char * | evas_gl_string_query (Evas_GL *evas_gl, int name) |
Returns a pointer to a static, null-terminated string describing some aspect of Evas GL. | |
Evas_GL_Func | evas_gl_proc_address_get (Evas_GL *evas_gl, const char *name) |
Returns a extension function from the Evas_GL glue layer. | |
Eina_Bool | evas_gl_native_surface_get (Evas_GL *evas_gl, Evas_GL_Surface *surf, Evas_Native_Surface *ns) |
Fills in the Native Surface information from a given Evas GL surface. | |
Evas_GL_API * | evas_gl_api_get (Evas_GL *evas_gl) |
Gets the API for rendering using OpenGL. | |
Evas_GL_API * | evas_gl_context_api_get (Evas_GL *evas_gl, Evas_GL_Context *ctx) |
Gets the API for rendering using OpenGL with non standard contexts. | |
int | evas_gl_rotation_get (Evas_GL *evas_gl) |
Get the current rotation of the view, in degrees. | |
Eina_Bool | evas_gl_surface_query (Evas_GL *evas_gl, Evas_GL_Surface *surface, int attribute, void *value) |
Query a surface for its properties. | |
int | evas_gl_error_get (Evas_GL *evas_gl) |
Returns the last error of any evas_gl function called in the current thread. Initially, the error is set to EVAS_GL_SUCCESS. A call to evas_gl_error_get resets the error to EVAS_GL_SUCCESS. | |
Evas_GL_Context * | evas_gl_current_context_get (Evas_GL *evas_gl) |
Returns the Evas GL context object in use or set by evas_gl_make_current. | |
Evas_GL_Surface * | evas_gl_current_surface_get (Evas_GL *evas_gl) |
Returns the Evas GL surface object in use or set by evas_gl_make_current. | |
Evas_GL * | evas_gl_current_evas_gl_get (Evas_GL_Context **context, Evas_GL_Surface **surface) |
Get current Evas GL. | |
Typedefs | |
typedef struct _Evas_GL | Evas_GL |
The structure type of the Evas GL object used to render GL in Evas. | |
typedef struct _Evas_GL_Surface | Evas_GL_Surface |
The structure type of the Evas GL Surface object, a GL rendering target in Evas GL. | |
typedef struct _Evas_GL_Context | Evas_GL_Context |
The structure type of the Evas GL Context object, a GL rendering context in Evas GL. | |
typedef struct _Evas_GL_Config | Evas_GL_Config |
The structure type of the Evas GL Surface configuration object for surface creation. | |
typedef struct _Evas_GL_API | Evas_GL_API |
The structure type of the Evas GL API object that contains the GL APIs to be used in Evas GL. | |
typedef void * | Evas_GL_Func |
Represents a function pointer, that can be used for Evas GL extensions. | |
typedef void * | EvasGLImage |
Represents an Evas GL Image object used with Evas GL Image extensions. | |
typedef enum _Evas_GL_Color_Format | Evas_GL_Color_Format |
Enumeration that defines the available surface color formats. | |
typedef enum _Evas_GL_Depth_Bits | Evas_GL_Depth_Bits |
Enumeration that defines the Surface Depth Format. | |
typedef enum _Evas_GL_Stencil_Bits | Evas_GL_Stencil_Bits |
Enumeration that defines the Surface Stencil Format. | |
typedef enum _Evas_GL_Options_Bits | Evas_GL_Options_Bits |
Enumeration that defines the Configuration Options. | |
typedef enum _Evas_GL_Multisample_Bits | Evas_GL_Multisample_Bits |
Enumeration that defines the configuration options for a Multisample Anti-Aliased (MSAA) rendering surface. | |
typedef enum _Evas_GL_Context_Version | Evas_GL_Context_Version |
Enumeration that defines the available OpenGL ES version numbers. They can be used to create OpenGL-ES 1.1 contexts. | |
Defines | |
#define | EVAS_GL_EXTENSIONS 1 |
Constant to use when calling evas_gl_string_query to retrieve the available Evas_GL extensions. | |
#define | EVAS_GL_IMAGE_PRESERVED 0x30D2 |
An attribute for evasglCreateImage or evasglCreateImageForContext, the default is EINA_FALSE . Please refer to EGL_IMAGE_PRESERVED_KHR . | |
#define | EVAS_VG_PARENT_IMAGE 0x30BA |
A target for evasglCreateImage or evasglCreateImageForContext. | |
#define | EVAS_GL_TEXTURE_2D 0x30B1 |
An attribute for evasglCreateImage or evasglCreateImageForContext. | |
#define | EVAS_GL_TEXTURE_LEVEL 0x30BC |
An attribute for evasglCreateImage or evasglCreateImageForContext. | |
#define | EVAS_GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x30B3 |
A target for evasglCreateImage or evasglCreateImageForContext. | |
#define | EVAS_GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x30B4 |
A target for evasglCreateImage or evasglCreateImageForContext. | |
#define | EVAS_GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x30B5 |
A target for evasglCreateImage or evasglCreateImageForContext. | |
#define | EVAS_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x30B6 |
A target for evasglCreateImage or evasglCreateImageForContext. | |
#define | EVAS_GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x30B7 |
A target for evasglCreateImage or evasglCreateImageForContext. | |
#define | EVAS_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x30B8 |
A target for evasglCreateImage or evasglCreateImageForContext. | |
#define | EVAS_GL_TEXTURE_3D 0x30B2 |
A target for evasglCreateImage or evasglCreateImageForContext. | |
#define | EVAS_GL_TEXTURE_ZOFFSET 0x30BD |
An attribute for evasglCreateImage or evasglCreateImageForContext. | |
#define | EVAS_GL_RENDERBUFFER 0x30B9 |
A target for evasglCreateImage or evasglCreateImageForContext. | |
#define | EVAS_GL_NATIVE_SURFACE_TIZEN 0x32A1 |
A target for evasglCreateImage or evasglCreateImageForContext. This is a Tizen specific feature. | |
#define | EVAS_GL_WAYLAND_BUFFER_WL 0x31D5 |
A target for evasglCreateImage. | |
#define | EVAS_GL_WAYLAND_PLANE_WL 0x31D6 |
A attribute for evasglCreateImage. | |
#define | EVAS_GL_TEXTURE_Y_U_V_WL 0x31D7 |
A return value of evasglQueryWaylandBuffer with EVAS_GL_TEXTURE_FORMAT. | |
#define | EVAS_GL_TEXTURE_Y_UV_WL 0x31D8 |
A return value of evasglQueryWaylandBuffer with EVAS_GL_TEXTURE_FORMAT. | |
#define | EVAS_GL_TEXTURE_Y_XUXV_WL 0x31D9 |
A return value of evasglQueryWaylandBuffer with EVAS_GL_TEXTURE_FORMAT. | |
#define | EVAS_GL_WAYLAND_Y_INVERTED_WL 0x31DB |
A attribute for evasglQueryWaylandBuffer. | |
#define | EVAS_GL_API_VERSION 6 |
Defines the version of the API structure. |
#define EVAS_GL_API_VERSION 6 |
Defines the version of the API structure.
This helps applications know at runtime whether a function pointer exists or not.
Version 1: GLES 2.0 + GLES2 extensions only Version 2: GLES 2.0 + GLES2 extensions + GLES1 + GLES1.1 extensions Version 3: [version 2] + Wayland extensions Version 4: [version 3] + GLES3.0 + GLES3.0 extensions Version 5: [version 4] + GLES3.1 Version 6: [version 5] + GLES3.2
typedef enum _Evas_GL_Context_Version Evas_GL_Context_Version |
Enumeration that defines the available OpenGL ES version numbers. They can be used to create OpenGL-ES 1.1 contexts.
typedef enum _Evas_GL_Depth_Bits Evas_GL_Depth_Bits |
Enumeration that defines the Surface Depth Format.
typedef enum _Evas_GL_Multisample_Bits Evas_GL_Multisample_Bits |
Enumeration that defines the configuration options for a Multisample Anti-Aliased (MSAA) rendering surface.
typedef enum _Evas_GL_Options_Bits Evas_GL_Options_Bits |
Enumeration that defines the Configuration Options.
typedef enum _Evas_GL_Stencil_Bits Evas_GL_Stencil_Bits |
Enumeration that defines the Surface Stencil Format.
Enumeration that defines the available surface color formats.
EVAS_GL_RGB_888 |
Opaque RGB surface |
EVAS_GL_RGBA_8888 |
RGBA surface with alpha |
EVAS_GL_NO_FBO |
Special value for creating PBuffer surfaces without any attached buffer.
|
Enumeration that defines the available OpenGL ES version numbers. They can be used to create OpenGL-ES 1.1 contexts.
enum _Evas_GL_Depth_Bits |
Enumeration that defines the configuration options for a Multisample Anti-Aliased (MSAA) rendering surface.
Enumeration that defines the Configuration Options.
EVAS_GL_OPTIONS_NONE |
No extra options |
EVAS_GL_OPTIONS_DIRECT |
Optional hint to allow rendering directly to the Evas window if possible |
EVAS_GL_OPTIONS_CLIENT_SIDE_ROTATION |
Force direct rendering even if the canvas is rotated. In that case, it is the application's role to rotate the contents of the Evas_GL view.
|
EVAS_GL_OPTIONS_THREAD |
If enabled, Evas GL pixel callback will be called by another thread instead of main thread. This option can enhance performance because Evas GL is worked with aynchronized call, but user must guarantee synchronization with pixel callback and main loop when using this flag. |
Enumeration that defines the Surface Stencil Format.
Evas_GL_API* evas_gl_api_get | ( | Evas_GL * | evas_gl | ) |
Gets the API for rendering using OpenGL.
This returns a structure that contains all the OpenGL functions you can use to render in Evas. These functions consist of all the standard OpenGL-ES2.0 functions and any additional ones that Evas has decided to provide. This means that if you have your code ported to OpenGL-ES2.0, it is going to be easy to render to Evas.
[in] | evas_gl | The given Evas_GL object |
void evas_gl_config_free | ( | Evas_GL_Config * | cfg | ) |
Frees a config object created from evas_gl_config_new.
[in] | cfg | The configuration structure to free, it can not be accessed afterwards. |
Evas_GL_Config* evas_gl_config_new | ( | void | ) |
Allocates a new config object for the user to fill out.
Evas_GL_API* evas_gl_context_api_get | ( | Evas_GL * | evas_gl, |
Evas_GL_Context * | ctx | ||
) |
Gets the API for rendering using OpenGL with non standard contexts.
[in] | evas_gl | The given Evas_GL object |
[in] | ctx | Specifies which context to use, based on this, Evas GL will return a 1.1- or a 2.0-compatible OpenGL-ES API. |
Evas_GL_Context* evas_gl_context_create | ( | Evas_GL * | evas_gl, |
Evas_GL_Context * | share_ctx | ||
) |
Creates and returns a new Evas GL context object (OpenGL-ES 2.0).
[in] | evas_gl | The given Evas_GL object |
[in] | share_ctx | An Evas_GL context to share with the new context |
The API in use will be an OpenGL-ES 2.0 API (ie. with framebuffers and shaders). Consider calling evas_gl_context_version_create if you need an OpenGL-ES 1.1 context instead.
NULL
on failurevoid evas_gl_context_destroy | ( | Evas_GL * | evas_gl, |
Evas_GL_Context * | ctx | ||
) |
Destroys the given Evas GL context object.
[in] | evas_gl | The given Evas_GL object |
[in] | ctx | The given Evas GL context |
Evas_GL_Context* evas_gl_context_version_create | ( | Evas_GL * | evas_gl, |
Evas_GL_Context * | share_ctx, | ||
Evas_GL_Context_Version | version | ||
) |
Creates and returns a new Evas GL context object for OpenGL-ES 1.1 or 2.0.
[in] | evas_gl | The given Evas_GL object |
[in] | share_ctx | A context to share (can be NULL) |
[in] | version | Major OpenGL-ES version number |
NULL
on failureEvas_GL_Context* evas_gl_current_context_get | ( | Evas_GL * | evas_gl | ) |
Returns the Evas GL context object in use or set by evas_gl_make_current.
[in] | evas_gl | The given Evas_GL object |
NULL
in case of failure and when there is no current context in this thread.Evas_GL* evas_gl_current_evas_gl_get | ( | Evas_GL_Context ** | context, |
Evas_GL_Surface ** | surface | ||
) |
Get current Evas GL.
[out] | context | Optional return value for the current context |
[out] | surface | Optional return value for the current surface |
Evas_GL_Surface* evas_gl_current_surface_get | ( | Evas_GL * | evas_gl | ) |
Returns the Evas GL surface object in use or set by evas_gl_make_current.
[in] | evas_gl | The given Evas_GL object |
NULL
in case of failure and when there is no current surface in this thread.int evas_gl_error_get | ( | Evas_GL * | evas_gl | ) |
Returns the last error of any evas_gl function called in the current thread. Initially, the error is set to EVAS_GL_SUCCESS. A call to evas_gl_error_get resets the error to EVAS_GL_SUCCESS.
[in] | evas_gl | The given Evas_GL object |
EVAS_GL
error code.void evas_gl_free | ( | Evas_GL * | evas_gl | ) |
Frees an Evas_GL object.
[in] | evas_gl | The given Evas_GL object to destroy |
Eina_Bool evas_gl_make_current | ( | Evas_GL * | evas_gl, |
Evas_GL_Surface * | surf, | ||
Evas_GL_Context * | ctx | ||
) |
Sets the given context as the current context for the given surface.
[in] | evas_gl | The given Evas_GL object |
[in] | surf | The given Evas GL surface |
[in] | ctx | The given Evas GL context |
EINA_TRUE
if successful, otherwise EINA_FALSE
if notEina_Bool evas_gl_native_surface_get | ( | Evas_GL * | evas_gl, |
Evas_GL_Surface * | surf, | ||
Evas_Native_Surface * | ns | ||
) |
Fills in the Native Surface information from a given Evas GL surface.
[in] | evas_gl | The given Evas_GL object |
[in] | surf | The given Evas GL surface to retrieve the Native Surface information from |
[out] | ns | The native surface structure that the function fills in |
EINA_TRUE
if successful, otherwise EINA_FALSE
if notThis function can be called to later set this native surface as source of an Evas Object Image. Please refer to evas_object_image_native_surface_set.
ns
since its properties are internal to Evas and are not meant to be tampered with in any way or form from outside Evas. Evas_GL* evas_gl_new | ( | Evas * | e | ) |
Creates a new Evas_GL object and returns a handle for GL rendering with the EFL.
[in] | e | The given Evas canvas to use |
NULL
in case of failureEvas_GL_Surface* evas_gl_pbuffer_surface_create | ( | Evas_GL * | evas_gl, |
Evas_GL_Config * | cfg, | ||
int | w, | ||
int | h, | ||
const int * | attrib_list | ||
) |
Create a pixel buffer surface.
[in] | evas_gl | The given Evas_GL object |
[in] | cfg | Pixel format and configuration of the pixel buffer surface |
[in] | w | Requested width of the buffer |
[in] | h | Requested height of the buffer |
[in] | attrib_list | An optional list of attribute-value pairs terminated by attribute 0, can be NULL . Currently, no attributes are supported. |
NULL
on failureEvas_GL_Func evas_gl_proc_address_get | ( | Evas_GL * | evas_gl, |
const char * | name | ||
) |
Returns a extension function from the Evas_GL glue layer.
[in] | evas_gl | The given Evas_GL object |
[in] | name | The name of the function to return |
int evas_gl_rotation_get | ( | Evas_GL * | evas_gl | ) |
Get the current rotation of the view, in degrees.
[in] | evas_gl | The current Evas_GL object |
const char* evas_gl_string_query | ( | Evas_GL * | evas_gl, |
int | name | ||
) |
Returns a pointer to a static, null-terminated string describing some aspect of Evas GL.
[in] | evas_gl | The given Evas_GL object |
[in] | name | A symbolic constant, only EVAS_GL_EXTENSIONS is supported for now |
Evas_GL_Surface* evas_gl_surface_create | ( | Evas_GL * | evas_gl, |
Evas_GL_Config * | cfg, | ||
int | w, | ||
int | h | ||
) |
Creates and returns a new Evas_GL_Surface object for GL Rendering.
[in] | evas_gl | The given Evas_GL object |
[in] | cfg | The pixel format and configuration of the rendering surface |
[in] | w | The width of the surface |
[in] | h | The height of the surface |
NULL
on failurevoid evas_gl_surface_destroy | ( | Evas_GL * | evas_gl, |
Evas_GL_Surface * | surf | ||
) |
Destroys an Evas GL Surface.
[in] | evas_gl | The given Evas_GL object |
[in] | surf | The given GL surface object |
Eina_Bool evas_gl_surface_query | ( | Evas_GL * | evas_gl, |
Evas_GL_Surface * | surface, | ||
int | attribute, | ||
void * | value | ||
) |
Query a surface for its properties.
[in] | evas_gl | The current Evas_GL object |
[in] | surface | An Evas_GL_Surface surface to query |
[in] | attribute | Specifies the attribute to query. |
[out] | value | Returns the requested value (usually an int) |