summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2015-04-06 22:48:58 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-04-07 11:44:39 +0900
commit8021b5ae2acce47eb2eb17f885a23fc612139250 (patch)
tree623516c2489d393d0ef34465fb25d3faf773f8a9
parentb5e2191ea43447b04f3c155f326d2a2bdb8ae148 (diff)
elm_test: GLView: Add depth to the window
Without depth, glview / evas gl basically fall back to indirect rendering. Also change bg color from yellowish to brown (and use PREMULTIPLIED colors, not random values).
-rw-r--r--src/bin/test_glview.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/bin/test_glview.c b/src/bin/test_glview.c
index fc35e488e..4f7c36756 100644
--- a/src/bin/test_glview.c
+++ b/src/bin/test_glview.c
@@ -265,7 +265,7 @@ gears_draw(GLData *gld)
265 static const GLfloat blue[4] = { 0.2, 0.2, 1.0, 1.0 }; 265 static const GLfloat blue[4] = { 0.2, 0.2, 1.0, 1.0 };
266 GLfloat m[16]; 266 GLfloat m[16];
267 267
268 gl->glClearColor(0.8, 0.8, 0.1, 0.5); 268 gl->glClearColor(0x25 / 255., 0x13 / 255., 0.0, 1.0);
269 gl->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 269 gl->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
270 270
271 memcpy(m, gld->proj, sizeof m); 271 memcpy(m, gld->proj, sizeof m);
@@ -510,6 +510,8 @@ _on_direct(void *data,
510{ 510{
511 if (!data) return; 511 if (!data) return;
512 512
513 // ON_DEMAND is necessary for Direct Rendering
514 elm_glview_render_policy_set(data, ELM_GLVIEW_RENDER_POLICY_ON_DEMAND);
513 elm_glview_mode_set(data, 0 515 elm_glview_mode_set(data, 0
514 | ELM_GLVIEW_ALPHA 516 | ELM_GLVIEW_ALPHA
515 | ELM_GLVIEW_DEPTH 517 | ELM_GLVIEW_DEPTH
@@ -524,6 +526,8 @@ _on_indirect(void *data,
524{ 526{
525 if (!data) return; 527 if (!data) return;
526 528
529 // note that with policy ALWAYS the window will flicker on resize
530 elm_glview_render_policy_set(data, ELM_GLVIEW_RENDER_POLICY_ALWAYS);
527 elm_glview_mode_set(data, 0 531 elm_glview_mode_set(data, 0
528 | ELM_GLVIEW_ALPHA 532 | ELM_GLVIEW_ALPHA
529 | ELM_GLVIEW_DEPTH 533 | ELM_GLVIEW_DEPTH
@@ -614,6 +618,10 @@ test_glview(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_in
614 Ecore_Animator *ani; 618 Ecore_Animator *ani;
615 GLData *gld = NULL; 619 GLData *gld = NULL;
616 620
621 // since we want a depth buffer and direct rendering, we need the window
622 // itself to have a depth buffer
623 elm_config_accel_preference_set("gl:depth");
624
617 // alloc a data struct to hold our relevant gl info in 625 // alloc a data struct to hold our relevant gl info in
618 if (!(gld = calloc(1, sizeof(GLData)))) return; 626 if (!(gld = calloc(1, sizeof(GLData)))) return;
619 gldata_init(gld); 627 gldata_init(gld);
@@ -642,7 +650,7 @@ test_glview(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_in
642 elm_glview_init_func_set(gl, _init_gl); 650 elm_glview_init_func_set(gl, _init_gl);
643 elm_glview_del_func_set(gl, _del_gl); 651 elm_glview_del_func_set(gl, _del_gl);
644 elm_glview_resize_func_set(gl, _resize_gl); 652 elm_glview_resize_func_set(gl, _resize_gl);
645 elm_glview_render_func_set(gl, (Elm_GLView_Func_Cb)_draw_gl); 653 elm_glview_render_func_set(gl, _draw_gl);
646 elm_box_pack_end(bx, gl); 654 elm_box_pack_end(bx, gl);
647 evas_object_show(gl); 655 evas_object_show(gl);
648 656