Tizen Native API  5.5

glview_inheritance_tree.png

A GLView widget allows for simple GL rendering in elementary environment. GLView hides all the complicated evas_gl details so that the user only has to deal with registering a few callback functions for rendering to a surface using OpenGL APIs.

This widget emits the following signals, besides the ones sent from GLView:

  • "focused" - when glview has received focus.
  • "unfocused" - when glview has lost focus.
  • "language,changed" - the program's language changed

Below is an illustrative example of how to use GLView and and OpenGL to render in elementary environment. glview_example_01_page

Functions

Eina_Bool elm_glview_resize_policy_set (Elm_Glview *obj, Elm_GLView_Resize_Policy policy)
 Set the resize policy for the glview object.
Eina_Bool elm_glview_render_policy_set (Elm_Glview *obj, Elm_GLView_Render_Policy policy)
 Set the render policy for the glview object.
Eina_Bool elm_glview_mode_set (Elm_Glview *obj, Elm_GLView_Mode mode)
 Set the mode of the GLView. Supports alpha, depth, stencil.
Evas_GL_APIelm_glview_gl_api_get (const Elm_Glview *obj)
 Get the gl api struct for gl rendering.
Evas_GLelm_glview_evas_gl_get (const Elm_Glview *obj)
 Get the internal Evas GL attached to this view.
int elm_glview_rotation_get (const Elm_Glview *obj)
 Get the current GL view's rotation when using direct rendering.
Evas_Objectelm_glview_add (Evas_Object *parent)
void elm_glview_changed_set (Evas_Object *obj)
void elm_glview_size_get (const Evas_Object *obj, int *w, int *h)
void elm_glview_size_set (Evas_Object *obj, int w, int h)
void elm_glview_del_func_set (Evas_Object *obj, Elm_GLView_Func_Cb func)
void elm_glview_resize_func_set (Evas_Object *obj, Elm_GLView_Func_Cb func)
void elm_glview_render_func_set (Evas_Object *obj, Elm_GLView_Func_Cb func)

Function Documentation

Add a new glview to the parent

Parameters:
parentThe parent object
Returns:
The new object or NULL if it cannot be created
Since :
2.3.1
Examples:
glview_example_01.c.

Notifies that there has been changes in the GLView.

Parameters:
objThe GLView object
Since :
2.3.1
Examples:
glview_example_01.c.
void elm_glview_del_func_set ( Evas_Object obj,
Elm_GLView_Func_Cb  func 
)

Set the delete function that runs in the main loop.

Parameters:
objThe GLView object
funcThe callback function
Since :
2.3.1
Examples:
glview_example_01.c.
Evas_GL* elm_glview_evas_gl_get ( const Elm_Glview *  obj)

Get the internal Evas GL attached to this view.

Note:
The returned Evas_GL must not be destroyed as it is still owned by the view. But this pointer can be used then to call all the evas_gl_ functions.
Parameters:
[in]objThe object.
Returns:
Evas GL
Since (EFL) :
1.12
Since :
2.3.1
Evas_GL_API* elm_glview_gl_api_get ( const Elm_Glview *  obj)

Get the gl api struct for gl rendering.

Parameters:
[in]objThe object.
Returns:
GL API
Since :
2.3.1
Examples:
glview_example_01.c.
Eina_Bool elm_glview_mode_set ( Elm_Glview *  obj,
Elm_GLView_Mode  mode 
)

Set the mode of the GLView. Supports alpha, depth, stencil.

Direct is a hint for the elm_glview to render directly to the window given that the right conditions are met. Otherwise it falls back to rendering to an offscreen buffer before it gets composited to the window.

Parameters:
[in]objThe object.
[in]modeThe mode Options OR'ed enabling Alpha, Depth, Stencil, Direct.
Returns:
true on success, false otherwise
Since :
2.3.1
Examples:
glview_example_01.c.
void elm_glview_render_func_set ( Evas_Object obj,
Elm_GLView_Func_Cb  func 
)

Set the render function that runs in the main loop.

Parameters:
objThe GLView object
funcThe callback function
Since :
2.3.1
Examples:
glview_example_01.c.
Eina_Bool elm_glview_render_policy_set ( Elm_Glview *  obj,
Elm_GLView_Render_Policy  policy 
)

Set the render policy for the glview object.

By default, the render policy is set to #ELM_GLVIEW_RENDER_POLICY_ON_DEMAND. This policy is set such that during the render loop, glview is only redrawn if it needs to be redrawn. (i.e. when it is visible) If the policy is set to #ELM_GLVIEWW_RENDER_POLICY_ALWAYS, it redraws regardless of whether it is visible or needs redrawing.

Parameters:
[in]objThe object.
[in]policyThe render policy.
Returns:
true on success, false otherwise
Since :
2.3.1
Examples:
glview_example_01.c.
void elm_glview_resize_func_set ( Evas_Object obj,
Elm_GLView_Func_Cb  func 
)

Set the resize function that gets called when resize happens.

Parameters:
objThe GLView object
funcThe callback function
Since :
2.3.1
Examples:
glview_example_01.c.
Eina_Bool elm_glview_resize_policy_set ( Elm_Glview *  obj,
Elm_GLView_Resize_Policy  policy 
)

Set the resize policy for the glview object.

By default, the resize policy is set to #ELM_GLVIEW_RESIZE_POLICY_RECREATE. When resize is called it destroys the previous surface and recreates the newly specified size. If the policy is set to #ELM_GLVIEW_RESIZE_POLICY_SCALE, however, glview only scales the image object and not the underlying GL Surface.

Parameters:
[in]objThe object.
[in]policyThe scaling policy.
Returns:
true on success, false otherwise
Since :
2.3.1
Examples:
glview_example_01.c.
int elm_glview_rotation_get ( const Elm_Glview *  obj)

Get the current GL view's rotation when using direct rendering.

Note:
This rotation can be different from the device orientation. This rotation value must be used in case of direct rendering and should be taken into account by the application when setting the internal rotation matrix for the view.
Parameters:
[in]objThe object.
Returns:
A window rotation in degrees (0, 90, 180 or 270).
Since (EFL) :
1.12
Since :
3.0f(2.3.1)
void elm_glview_size_get ( const Evas_Object obj,
int *  w,
int *  h 
)

Gets the size of the GLView.

Parameters:
objThe GLView object
wpointer of int width
hpointer of int height
Since :
2.3.1
Examples:
glview_example_01.c.
void elm_glview_size_set ( Evas_Object obj,
int  w,
int  h 
)

Sets the size of the GLView.

Parameters:
objThe GLView object
wwidth of GLView
hheight of GLView
Since :
2.3.1