GLView

Typedefs | Enumerations | Functions
GLView
Elementary

## Typedefs
typedef void(* | Elm_GLView_Func_Cb) (Evas_Object *obj)

## Enumerations
enum | Elm_GLView_Mode { ELM_GLVIEW_NONE = 0 , ELM_GLVIEW_ALPHA = 2 , ELM_GLVIEW_DEPTH = 4 , ELM_GLVIEW_STENCIL = 8 , ELM_GLVIEW_DIRECT = 16 , ELM_GLVIEW_CLIENT_SIDE_ROTATION = 32 , ELM_GLVIEW_DEPTH_8 = 68 , ELM_GLVIEW_DEPTH_16 = 132 , ELM_GLVIEW_DEPTH_24 = 196 , ELM_GLVIEW_DEPTH_32 = 260 , ELM_GLVIEW_STENCIL_1 = 520 , ELM_GLVIEW_STENCIL_2 = 1032 , ELM_GLVIEW_STENCIL_4 = 1544 , ELM_GLVIEW_STENCIL_8 = 2056 , ELM_GLVIEW_STENCIL_16 = 2568 , ELM_GLVIEW_MULTISAMPLE_LOW = 4096 , ELM_GLVIEW_MULTISAMPLE_MED = 8192 , ELM_GLVIEW_MULTISAMPLE_HIGH = 12288 , ELM_GLVIEW_NONE = 0 , ELM_GLVIEW_ALPHA = 2 , ELM_GLVIEW_DEPTH = 4 , ELM_GLVIEW_STENCIL = 8 , ELM_GLVIEW_DIRECT = 16 , ELM_GLVIEW_CLIENT_SIDE_ROTATION = 32 , ELM_GLVIEW_DEPTH_8 = 68 , ELM_GLVIEW_DEPTH_16 = 132 , ELM_GLVIEW_DEPTH_24 = 196 , ELM_GLVIEW_DEPTH_32 = 260 , ELM_GLVIEW_STENCIL_1 = 520 , ELM_GLVIEW_STENCIL_2 = 1032 , ELM_GLVIEW_STENCIL_4 = 1544 , ELM_GLVIEW_STENCIL_8 = 2056 , ELM_GLVIEW_STENCIL_16 = 2568 , ELM_GLVIEW_MULTISAMPLE_LOW = 4096 , ELM_GLVIEW_MULTISAMPLE_MED = 8192 , ELM_GLVIEW_MULTISAMPLE_HIGH = 12288 }
| Selects the target surface properties. More...
enum | Elm_GLView_Mode { ELM_GLVIEW_NONE = 0 , ELM_GLVIEW_ALPHA = 2 , ELM_GLVIEW_DEPTH = 4 , ELM_GLVIEW_STENCIL = 8 , ELM_GLVIEW_DIRECT = 16 , ELM_GLVIEW_CLIENT_SIDE_ROTATION = 32 , ELM_GLVIEW_DEPTH_8 = 68 , ELM_GLVIEW_DEPTH_16 = 132 , ELM_GLVIEW_DEPTH_24 = 196 , ELM_GLVIEW_DEPTH_32 = 260 , ELM_GLVIEW_STENCIL_1 = 520 , ELM_GLVIEW_STENCIL_2 = 1032 , ELM_GLVIEW_STENCIL_4 = 1544 , ELM_GLVIEW_STENCIL_8 = 2056 , ELM_GLVIEW_STENCIL_16 = 2568 , ELM_GLVIEW_MULTISAMPLE_LOW = 4096 , ELM_GLVIEW_MULTISAMPLE_MED = 8192 , ELM_GLVIEW_MULTISAMPLE_HIGH = 12288 , ELM_GLVIEW_NONE = 0 , ELM_GLVIEW_ALPHA = 2 , ELM_GLVIEW_DEPTH = 4 , ELM_GLVIEW_STENCIL = 8 , ELM_GLVIEW_DIRECT = 16 , ELM_GLVIEW_CLIENT_SIDE_ROTATION = 32 , ELM_GLVIEW_DEPTH_8 = 68 , ELM_GLVIEW_DEPTH_16 = 132 , ELM_GLVIEW_DEPTH_24 = 196 , ELM_GLVIEW_DEPTH_32 = 260 , ELM_GLVIEW_STENCIL_1 = 520 , ELM_GLVIEW_STENCIL_2 = 1032 , ELM_GLVIEW_STENCIL_4 = 1544 , ELM_GLVIEW_STENCIL_8 = 2056 , ELM_GLVIEW_STENCIL_16 = 2568 , ELM_GLVIEW_MULTISAMPLE_LOW = 4096 , ELM_GLVIEW_MULTISAMPLE_MED = 8192 , ELM_GLVIEW_MULTISAMPLE_HIGH = 12288 }
| Selects the target surface properties. More...

## Functions
Eina_Bool | elm_glview_resize_policy_set (Elm_Glview *obj, Elm_GLView_Resize_Policy policy)
| Set the resize policy for the glview object. More...
Eina_Bool | elm_glview_render_policy_set (Elm_Glview *obj, Elm_GLView_Render_Policy policy)
| Set the render policy for the glview object. More...
Eina_Bool | elm_glview_mode_set (Elm_Glview *obj, Elm_GLView_Mode mode)
| Set the mode of the GLView. More...
Evas_GL_API * | elm_glview_gl_api_get (const Elm_Glview *obj)
| Get the gl api struct for gl rendering. More...
Evas_GL * | elm_glview_evas_gl_get (const Elm_Glview *obj)
| Get the internal Evas GL attached to this view. More...
int | elm_glview_rotation_get (const Elm_Glview *obj)
| Get the current GL view's rotation when using direct rendering. More...
Evas_Object * | elm_glview_add (Evas_Object *parent)
| Add a new glview to the parent. More...
void | elm_glview_changed_set (Evas_Object *obj)
| Notifies that there has been changes in the GLView. More...
void | elm_glview_size_get (const Evas_Object *obj, int *w, int *h)
| Gets the size of the GLView. More...
void | elm_glview_size_set (Evas_Object *obj, int w, int h)
| Sets the size of the GLView. More...
void | elm_glview_del_func_set (Evas_Object *obj, Elm_GLView_Func_Cb func)
| Set the delete function that runs in the main loop. More...
void | elm_glview_resize_func_set (Evas_Object *obj, Elm_GLView_Func_Cb func)
| Set the resize function that gets called when resize happens. More...
void | elm_glview_render_func_set (Evas_Object *obj, Elm_GLView_Func_Cb func)
| Set the render function that runs in the main loop. More...

## Detailed Description

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

## Enumeration Type Documentation

## ◆ Elm_GLView_Mode [1/2]

enum Elm_GLView_Mode

Selects the target surface properties.

An OR combination of Elm_GLView_Mode values should be passed to elm_glview_mode_set when setting up a GL widget. These flags will specify the properties of the rendering target surface; in particular, the mode can request the surface to support alpha, depth and stencil buffers.

ELM_GLVIEW_CLIENT_SIDE_ROTATION is a special value that indicates to EFL that the application will handle the view rotation when the device is rotated. This is needed only when the application requests direct rendering. Please refer to Evas_GL for more information about direct rendering.

See elm_obj_glview_mode_set See elm_opengl_page

Enumerator
ELM_GLVIEW_NONE | Default mode.
ELM_GLVIEW_ALPHA | Alpha channel enabled rendering mode.
ELM_GLVIEW_DEPTH | Depth buffer enabled rendering mode (24 bits by default)
ELM_GLVIEW_STENCIL | Stencil buffer enabled rendering mode (8 bits by default)
ELM_GLVIEW_DIRECT | Request direct rendering, unless there must be a fallback.
ELM_GLVIEW_CLIENT_SIDE_ROTATION | Client will handle GL view rotation if direct rendering is enabled.
ELM_GLVIEW_DEPTH_8 | Request min. 8 bits for the depth buffer
ELM_GLVIEW_DEPTH_16 | Request min. 16 bits for the depth buffer
ELM_GLVIEW_DEPTH_24 | Request min. 24 bits for the depth buffer (default)
ELM_GLVIEW_DEPTH_32 | Request min. 32 bits for the depth buffer
ELM_GLVIEW_STENCIL_1 | Request min. 1 bits for the stencil buffer
ELM_GLVIEW_STENCIL_2 | Request min. 2 bits for the stencil buffer
ELM_GLVIEW_STENCIL_4 | Request min. 4 bits for the stencil buffer
ELM_GLVIEW_STENCIL_8 | Request min. 8 bits for the stencil buffer (default)
ELM_GLVIEW_STENCIL_16 | Request min. 16 bits for the stencil buffer
ELM_GLVIEW_MULTISAMPLE_LOW | MSAA with minimum number of samples.
ELM_GLVIEW_MULTISAMPLE_MED | MSAA with half the number of maximum samples.
ELM_GLVIEW_MULTISAMPLE_HIGH | MSAA with maximum number of samples.
ELM_GLVIEW_NONE | Default mode.
ELM_GLVIEW_ALPHA | Alpha channel enabled rendering mode.
ELM_GLVIEW_DEPTH | Depth buffer enabled rendering mode (24 bits by default)
ELM_GLVIEW_STENCIL | Stencil buffer enabled rendering mode (8 bits by default)
ELM_GLVIEW_DIRECT | Request direct rendering, unless there must be a fallback.
ELM_GLVIEW_CLIENT_SIDE_ROTATION | Client will handle GL view rotation if direct rendering is enabled.
ELM_GLVIEW_DEPTH_8 | Request min. 8 bits for the depth buffer
ELM_GLVIEW_DEPTH_16 | Request min. 16 bits for the depth buffer
ELM_GLVIEW_DEPTH_24 | Request min. 24 bits for the depth buffer (default)
ELM_GLVIEW_DEPTH_32 | Request min. 32 bits for the depth buffer
ELM_GLVIEW_STENCIL_1 | Request min. 1 bits for the stencil buffer
ELM_GLVIEW_STENCIL_2 | Request min. 2 bits for the stencil buffer
ELM_GLVIEW_STENCIL_4 | Request min. 4 bits for the stencil buffer
ELM_GLVIEW_STENCIL_8 | Request min. 8 bits for the stencil buffer (default)
ELM_GLVIEW_STENCIL_16 | Request min. 16 bits for the stencil buffer
ELM_GLVIEW_MULTISAMPLE_LOW | MSAA with minimum number of samples.
ELM_GLVIEW_MULTISAMPLE_MED | MSAA with half the number of maximum samples.
ELM_GLVIEW_MULTISAMPLE_HIGH | MSAA with maximum number of samples.

## ◆ Elm_GLView_Mode [2/2]

enum Elm_GLView_Mode

Selects the target surface properties.

An OR combination of Elm_GLView_Mode values should be passed to elm_glview_mode_set when setting up a GL widget. These flags will specify the properties of the rendering target surface; in particular, the mode can request the surface to support alpha, depth and stencil buffers.

ELM_GLVIEW_CLIENT_SIDE_ROTATION is a special value that indicates to EFL that the application will handle the view rotation when the device is rotated. This is needed only when the application requests direct rendering. Please refer to Evas_GL for more information about direct rendering.

See elm_glview_mode_set See elm_opengl_page

Enumerator
ELM_GLVIEW_NONE | Default mode.
ELM_GLVIEW_ALPHA | Alpha channel enabled rendering mode.
ELM_GLVIEW_DEPTH | Depth buffer enabled rendering mode (24 bits by default)
ELM_GLVIEW_STENCIL | Stencil buffer enabled rendering mode (8 bits by default)
ELM_GLVIEW_DIRECT | Request direct rendering, unless there must be a fallback.
ELM_GLVIEW_CLIENT_SIDE_ROTATION | Client will handle GL view rotation if direct rendering is enabled.
ELM_GLVIEW_DEPTH_8 | Request min. 8 bits for the depth buffer
ELM_GLVIEW_DEPTH_16 | Request min. 16 bits for the depth buffer
ELM_GLVIEW_DEPTH_24 | Request min. 24 bits for the depth buffer (default)
ELM_GLVIEW_DEPTH_32 | Request min. 32 bits for the depth buffer
ELM_GLVIEW_STENCIL_1 | Request min. 1 bits for the stencil buffer
ELM_GLVIEW_STENCIL_2 | Request min. 2 bits for the stencil buffer
ELM_GLVIEW_STENCIL_4 | Request min. 4 bits for the stencil buffer
ELM_GLVIEW_STENCIL_8 | Request min. 8 bits for the stencil buffer (default)
ELM_GLVIEW_STENCIL_16 | Request min. 16 bits for the stencil buffer
ELM_GLVIEW_MULTISAMPLE_LOW | MSAA with minimum number of samples.
ELM_GLVIEW_MULTISAMPLE_MED | MSAA with half the number of maximum samples.
ELM_GLVIEW_MULTISAMPLE_HIGH | MSAA with maximum number of samples.
ELM_GLVIEW_NONE | Default mode.
ELM_GLVIEW_ALPHA | Alpha channel enabled rendering mode.
ELM_GLVIEW_DEPTH | Depth buffer enabled rendering mode (24 bits by default)
ELM_GLVIEW_STENCIL | Stencil buffer enabled rendering mode (8 bits by default)
ELM_GLVIEW_DIRECT | Request direct rendering, unless there must be a fallback.
ELM_GLVIEW_CLIENT_SIDE_ROTATION | Client will handle GL view rotation if direct rendering is enabled.
ELM_GLVIEW_DEPTH_8 | Request min. 8 bits for the depth buffer
ELM_GLVIEW_DEPTH_16 | Request min. 16 bits for the depth buffer
ELM_GLVIEW_DEPTH_24 | Request min. 24 bits for the depth buffer (default)
ELM_GLVIEW_DEPTH_32 | Request min. 32 bits for the depth buffer
ELM_GLVIEW_STENCIL_1 | Request min. 1 bits for the stencil buffer
ELM_GLVIEW_STENCIL_2 | Request min. 2 bits for the stencil buffer
ELM_GLVIEW_STENCIL_4 | Request min. 4 bits for the stencil buffer
ELM_GLVIEW_STENCIL_8 | Request min. 8 bits for the stencil buffer (default)
ELM_GLVIEW_STENCIL_16 | Request min. 16 bits for the stencil buffer
ELM_GLVIEW_MULTISAMPLE_LOW | MSAA with minimum number of samples.
ELM_GLVIEW_MULTISAMPLE_MED | MSAA with half the number of maximum samples.
ELM_GLVIEW_MULTISAMPLE_HIGH | MSAA with maximum number of samples.

## Function Documentation

## ◆ elm_glview_resize_policy_set()

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] | obj | The object.
  [in] | policy | The scaling policy.

Returns
  `true` on success, `false` otherwise

## ◆ elm_glview_render_policy_set()

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] | obj | The object.
  [in] | policy | The render policy.

Returns
  `true` on success, `false` otherwise

## ◆ elm_glview_mode_set()

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] | obj | The object.
  [in] | mode | The mode Options OR'ed enabling Alpha, Depth, Stencil, Direct.

Returns
  `true` on success, `false` otherwise

## ◆ elm_glview_gl_api_get()

Evas_GL_API* elm_glview_gl_api_get | ( | const Elm_Glview * | obj | ) |

Get the gl api struct for gl rendering.

Parameters

  [in] | obj | The object.

Returns
  GL API

## ◆ elm_glview_evas_gl_get()

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] | obj | The object.

Returns
  Evas GL

Since
  1.12

## ◆ elm_glview_rotation_get()

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] | obj | The object.

Returns
  A window rotation in degrees (0, 90, 180 or 270).

Since
  1.12

## ◆ elm_glview_add()

Evas_Object* elm_glview_add | ( | Evas_Object * | parent | ) |

Add a new glview to the parent.

Parameters

  parent | The parent object

Returns
  The new object or NULL if it cannot be created

References EINA_SAFETY_ON_NULL_RETURN_VAL, and EVAS_GL_GLES_2_X.

## ◆ elm_glview_changed_set()

void elm_glview_changed_set | ( | Evas_Object * | obj | ) |

Notifies that there has been changes in the GLView.

Parameters

  obj | The GLView object

## ◆ elm_glview_size_get()

void elm_glview_size_get | ( | const Evas_Object * | obj,
|  | int * | w,
|  | int * | h
| ) |  |

Gets the size of the GLView.

Parameters

  obj | The GLView object
  w | pointer of int width
  h | pointer of int height

## ◆ elm_glview_size_set()

void elm_glview_size_set | ( | Evas_Object * | obj,
|  | int | w,
|  | int | h
| ) |  |

Sets the size of the GLView.

Parameters

  obj | The GLView object
  w | width of GLView
  h | height of GLView

References EINA_SIZE2D.

## ◆ elm_glview_del_func_set()

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

  obj | The GLView object
  func | The callback function

## ◆ elm_glview_resize_func_set()

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

  obj | The GLView object
  func | The callback function

## ◆ elm_glview_render_func_set()

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

  obj | The GLView object
  func | The callback function