aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/evas/src/lib/Evas_GL.h
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/evas/src/lib/Evas_GL.h')
-rw-r--r--libraries/evas/src/lib/Evas_GL.h52
1 files changed, 39 insertions, 13 deletions
diff --git a/libraries/evas/src/lib/Evas_GL.h b/libraries/evas/src/lib/Evas_GL.h
index 04bedea..fdfbaad 100644
--- a/libraries/evas/src/lib/Evas_GL.h
+++ b/libraries/evas/src/lib/Evas_GL.h
@@ -28,7 +28,7 @@ typedef enum _Evas_GL_Depth_Bits
28 EVAS_GL_DEPTH_BIT_8 = 1, 28 EVAS_GL_DEPTH_BIT_8 = 1,
29 EVAS_GL_DEPTH_BIT_16 = 2, 29 EVAS_GL_DEPTH_BIT_16 = 2,
30 EVAS_GL_DEPTH_BIT_24 = 3, 30 EVAS_GL_DEPTH_BIT_24 = 3,
31 EVAS_GL_DEPTH_BIT_32 = 4, 31 EVAS_GL_DEPTH_BIT_32 = 4
32} Evas_GL_Depth_Bits; 32} Evas_GL_Depth_Bits;
33 33
34typedef enum _Evas_GL_Stencil_Bits 34typedef enum _Evas_GL_Stencil_Bits
@@ -38,14 +38,21 @@ typedef enum _Evas_GL_Stencil_Bits
38 EVAS_GL_STENCIL_BIT_2 = 2, 38 EVAS_GL_STENCIL_BIT_2 = 2,
39 EVAS_GL_STENCIL_BIT_4 = 3, 39 EVAS_GL_STENCIL_BIT_4 = 3,
40 EVAS_GL_STENCIL_BIT_8 = 4, 40 EVAS_GL_STENCIL_BIT_8 = 4,
41 EVAS_GL_STENCIL_BIT_16 = 5, 41 EVAS_GL_STENCIL_BIT_16 = 5
42} Evas_GL_Stencil_Bits; 42} Evas_GL_Stencil_Bits;
43 43
44typedef enum _Evas_GL_Options_Bits
45{
46 EVAS_GL_OPTIONS_NONE = 0,
47 EVAS_GL_OPTIONS_DIRECT = (1<<0)
48} Evas_GL_Options_Bits;
49
44struct _Evas_GL_Config 50struct _Evas_GL_Config
45{ 51{
46 Evas_GL_Color_Format color_format; 52 Evas_GL_Color_Format color_format;
47 Evas_GL_Depth_Bits depth_bits; 53 Evas_GL_Depth_Bits depth_bits;
48 Evas_GL_Stencil_Bits stencil_bits; 54 Evas_GL_Stencil_Bits stencil_bits;
55 Evas_GL_Options_Bits options_bits;
49}; 56};
50 57
51#define EVAS_GL_EXTENSIONS 1 58#define EVAS_GL_EXTENSIONS 1
@@ -73,6 +80,7 @@ typedef struct _GLData
73{ 80{
74 Evas_GL_Context *ctx; 81 Evas_GL_Context *ctx;
75 Evas_GL_Surface *sfc; 82 Evas_GL_Surface *sfc;
83 Evas_GL_Config *cfg;
76 Evas_GL *evasgl; 84 Evas_GL *evasgl;
77 Evas_GL_API *glapi; 85 Evas_GL_API *glapi;
78 GLuint program; 86 GLuint program;
@@ -93,13 +101,6 @@ static GLuint load_shader (GLData *gld, GLenum type, const char *shader_src)
93int 101int
94main(int argc, char **argv) 102main(int argc, char **argv)
95{ 103{
96 // config for the surface for evas_gl
97 Evas_GL_Config config =
98 {
99 EVAS_GL_RGBA_8888,
100 EVAS_GL_DEPTH_NONE,
101 EVAS_GL_STENCIL_NONE
102 };
103 // a size by default 104 // a size by default
104 int w = 256, h = 256; 105 int w = 256, h = 256;
105 // some variables we will use 106 // some variables we will use
@@ -124,8 +125,16 @@ main(int argc, char **argv)
124 // get the evas gl handle for doing gl things 125 // get the evas gl handle for doing gl things
125 gld->evasgl = evas_gl_new(canvas); 126 gld->evasgl = evas_gl_new(canvas);
126 gld->glapi = evas_gl_api_get(gld->evasgl); 127 gld->glapi = evas_gl_api_get(gld->evasgl);
128
129 // Set a surface config
130 gld->cfg = evas_gl_config_new();
131 gld->cfg->color_format = EVAS_GL_RGBA_8888;
132 //gld->cfg->depth_bits = EVAS_GL_DEPTH_NONE; // Othe config options
133 //gld->cfg->stencil_bits = EVAS_GL_STENCIL_NONE;
134 //gld->cfg->options_bits = EVAS_GL_OPTIONS_NONE;
135
127 // create a surface and context 136 // create a surface and context
128 gld->sfc = evas_gl_surface_create(gld->evasgl, &config, w, h); 137 gld->sfc = evas_gl_surface_create(gld->evasgl, gld->cfg, w, h);
129 gld->ctx = evas_gl_context_create(gld->evasgl, NULL); 138 gld->ctx = evas_gl_context_create(gld->evasgl, NULL);
130 //-// 139 //-//
131 //-//-//-// END GL INIT BLOB 140 //-//-//-// END GL INIT BLOB
@@ -207,6 +216,7 @@ on_del(void *data, Evas *e, Evas_Object *obj, void *event_info)
207 216
208 evas_gl_surface_destroy(gld->evasgl, gld->sfc); 217 evas_gl_surface_destroy(gld->evasgl, gld->sfc);
209 evas_gl_context_destroy(gld->evasgl, gld->ctx); 218 evas_gl_context_destroy(gld->evasgl, gld->ctx);
219 evas_gl_config_free(gld->cfg);
210 evas_gl_free(gld->evasgl); 220 evas_gl_free(gld->evasgl);
211 free(gld); 221 free(gld);
212} 222}
@@ -389,6 +399,22 @@ EAPI Evas_GL *evas_gl_new (Evas *e) EINA_WARN_UNU
389EAPI void evas_gl_free (Evas_GL *evas_gl) EINA_ARG_NONNULL(1); 399EAPI void evas_gl_free (Evas_GL *evas_gl) EINA_ARG_NONNULL(1);
390 400
391/** 401/**
402 * Allocates a new config object for the user to fill out.
403 *
404 * As long as the Evas creates a config object for the user, it takes care
405 * of the backward compatibility issue.
406 */
407EAPI Evas_GL_Config *evas_gl_config_new ();
408
409/**
410 * Frees a config object created from evas_gl_config_new.
411 *
412 * As long as the Evas creates a config object for the user, it takes care
413 * of the backward compatibility issue.
414 */
415EAPI void evas_gl_config_free (Evas_GL_Config *cfg) EINA_ARG_NONNULL(1);
416
417/**
392 * Creates and returns new Evas_GL_Surface object for GL Rendering. 418 * Creates and returns new Evas_GL_Surface object for GL Rendering.
393 * 419 *
394 * @param evas_gl The given Evas_GL object. 420 * @param evas_gl The given Evas_GL object.