/* Draw a gear wheel. You'll probably want to call this function when
* building a display list since we do a lot of trig here.
- *
+ *
* Input: inner_radius - radius of hole at center
* outer_radius - radius at center of teeth
* width - width of gear
s[4] = 0;
c[4] = 1;
v = gear->vertices;
- for (i = 0; i < teeth; i++)
+ for (i = 0; i < teeth; i++)
{
s[0] = s[4];
c[0] = c[4];
div_t d;
int i, j;
- for (i = 0; i < 16; i++)
+ for (i = 0; i < 16; i++)
{
tmp[i] = 0;
d = div(i, 4);
s = sin(angle);
c = cos(angle);
- GLfloat r[16] =
+ GLfloat r[16] =
{
x * x * (1 - c) + c, y * x * (1 - c) + z * s, x * z * (1 - c) - y * s, 0,
- x * y * (1 - c) - z * s, y * y * (1 - c) + c, y * z * (1 - c) + x * s, 0,
+ x * y * (1 - c) - z * s, y * y * (1 - c) + c, y * z * (1 - c) + x * s, 0,
x * z * (1 - c) + y * s, y * z * (1 - c) - x * s, z * z * (1 - c) + c, 0,
0, 0, 0, 1
};
static const GLfloat red[4] = { 0.8, 0.1, 0.0, 1.0 };
static const GLfloat green[4] = { 0.0, 0.8, 0.2, 1.0 };
static const GLfloat blue[4] = { 0.2, 0.2, 1.0, 1.0 };
- GLfloat m[16];
+ GLfloat m[16];
gl->glClearColor(0.8, 0.8, 0.1, 0.5);
gl->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
0.0, 0.0, 0.1, 0.0,
0.0, 0.0, 0.0, 1.0,
};
-
+
if (width < height)
ar = width;
else
gld->view_rotz = 0.0;
gld->angle = 0.0;
- gld->light[0] = 1.0;
- gld->light[1] = 1.0;
- gld->light[2] = -5.0;
+ gld->light[0] = 1.0;
+ gld->light[1] = 1.0;
+ gld->light[2] = -5.0;
}
Evas_GL_API *gl = elm_glview_gl_api_get(obj);
GLData *gld = evas_object_data_get(obj, "gld");
if (!gld) return;
-
+
elm_glview_size_get(obj, &w, &h);
if (!gld->initialized)
_del(void *data, Evas *evas __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
{
GLData *gld = evas_object_data_get(data, "gld");
- if (!gld)
+ if (!gld)
{
printf("Unable to get GLData. \n");
return;
}
-static void
+static void
_key_down(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
{
Evas_Event_Key_Down *ev;
}
}
-static void
+static void
_mouse_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
{
GLData *gld = evas_object_data_get(obj, "gld");
gld->mouse_down = 1;
}
-static void
+static void
_mouse_move(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
{
Evas_Event_Mouse_Move *ev;
}
}
-static void
+static void
_mouse_up(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
{
GLData *gld = evas_object_data_get(obj, "gld");
gld->mouse_down = 0;
}
-
+
void
test_glview(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{
Evas_Object *win, *bg, *bx, *bt, *gl;
Ecore_Animator *ani;
GLData *gld = NULL;
-
+
if (!(gld = calloc(1, sizeof(GLData)))) return;
gldata_init(gld);
evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(win, bx);
evas_object_show(bx);
-
+
gl = elm_glview_add(win);
evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_data_set(gl, "ani", ani);
evas_object_data_set(gl, "gld", gld);
evas_object_event_callback_add(gl, EVAS_CALLBACK_DEL, _del, gl);
-
+
bt = elm_button_add(win);
elm_button_label_set(bt, "OK");
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
{
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
-
+
if (wd->render_idle_enterer) ecore_idle_enterer_del(wd->render_idle_enterer);
if (wd->surface) evas_gl_surface_destroy(wd->evasgl, wd->surface);
evas_gl_surface_destroy(wd->evasgl, wd->surface);
wd->surface = NULL;
}
-
+
evas_object_image_size_set(wd->glview_image, wd->w, wd->h);
-
- if (!wd->surface)
+
+ if (!wd->surface)
{
Evas_Native_Surface ns;
-
- wd->surface = evas_gl_surface_create(wd->evasgl, &wd->config,
+
+ wd->surface = evas_gl_surface_create(wd->evasgl, &wd->config,
wd->w, wd->h);
evas_gl_native_surface_get(wd->evasgl, wd->surface, &ns);
evas_object_image_native_surface_set(wd->glview_image, &ns);
Evas_Coord w, h;
if (!wd) return;
- if (wd->scale_policy == ELM_GLVIEW_RESIZE_POLICY_RECREATE)
+ if (wd->scale_policy == ELM_GLVIEW_RESIZE_POLICY_RECREATE)
{
evas_object_geometry_get(wd->glview_image, NULL, NULL, &w, &h);
if ((w == 0) || (h == 0))
}
-static Eina_Bool
+static Eina_Bool
_render_cb(void *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
ecore_idle_enterer_del(wd->render_idle_enterer);
wd->render_idle_enterer = NULL;
}
-
+
// Set pixel getter callback
evas_object_image_pixels_get_callback_set
(wd->glview_image, (Evas_Object_Image_Pixels_Get_Cb)_render_cb, obj);
break;
case ELM_GLVIEW_RENDER_POLICY_ALWAYS:
-
+
// Unset the pixel getter callback if set already
evas_object_image_pixels_get_callback_set(wd->glview_image, NULL, NULL);
break;
Evas_Object *obj;
Evas *e;
Widget_Data *wd;
- Evas_GL_Config cfg = { EVAS_GL_RGB_8,
- EVAS_GL_DEPTH_NONE,
+ Evas_GL_Config cfg = { EVAS_GL_RGB_8,
+ EVAS_GL_DEPTH_NONE,
EVAS_GL_STENCIL_NONE };
ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
wd->render_idle_enterer = NULL;
- // Create Context
+ // Create Context
if (!wd->context)
{
wd->context = evas_gl_context_create(wd->evasgl, NULL);
/**
- * Set the mode of the GLView. Supports Three simple modes.
+ * Set the mode of the GLView. Supports Three simple modes.
*
* @param obj The glview object
- * @param mode The mode Options OR'ed enabling Alpha, Depth, Stencil.
+ * @param mode The mode Options OR'ed enabling Alpha, Depth, Stencil.
* @return True if set properly.
*
* @ingroup GLView
{
ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
Widget_Data *wd = elm_widget_data_get(obj);
- Evas_GL_Config cfg = { EVAS_GL_RGBA_8,
- EVAS_GL_DEPTH_NONE,
+ Evas_GL_Config cfg = { EVAS_GL_RGBA_8,
+ EVAS_GL_DEPTH_NONE,
EVAS_GL_STENCIL_NONE };
if (!wd) return EINA_FALSE;
// Check for Alpha Channel and enable it
if (mode & ELM_GLVIEW_ALPHA)
evas_object_image_alpha_set(wd->glview_image, EINA_TRUE);
- else
+ else
evas_object_image_alpha_set(wd->glview_image, EINA_FALSE);
-
+
wd->mode = mode;
wd->config = cfg;
-
+
elm_glview_changed_set(obj);
return EINA_TRUE;
*
* By default, the scaling 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,
+ * 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.
- *
+ *
* @ingroup GLView
*/
EAPI Eina_Bool
* 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
+ * to ELM_GLVIEWW_RENDER_POLICY_ALWAYS, it redraws regardless of whether it is
* visible/need redrawing or not.
- *
+ *
* @ingroup GLView
*/
EAPI Eina_Bool
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return EINA_FALSE;
- if ((policy != ELM_GLVIEW_RENDER_POLICY_ON_DEMAND) &&
+ if ((policy != ELM_GLVIEW_RENDER_POLICY_ON_DEMAND) &&
(policy != ELM_GLVIEW_RENDER_POLICY_ALWAYS))
{
ERR("Invalid Render Policy.\n");
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
-
+
if ((width == wd->w) && (height == wd->h)) return;
wd->w = width;
wd->h = height;
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
-
+
if (width) *width = wd->w;
if (height) *height = wd->h;
}