1 #include "evas_common.h" /* Also includes international specific stuff */
2 #include "evas_engine.h"
4 #include <dlfcn.h> /* dlopen,dlclose,etc */
6 static void* _sdl_output_setup (int w, int h, int fullscreen, int noframe);
8 int _evas_engine_GL_SDL_log_dom = -1;
9 /* function tables - filled in later (func and parent func) */
10 static Evas_Func func, pfunc;
15 Evas_Engine_Info_GL_SDL *info;
17 info = calloc(1, sizeof(Evas_Engine_Info_GL_SDL));
18 if (!info) return NULL;
19 info->magic.magic = rand();
24 eng_info_free(Evas *e __UNUSED__, void *info)
26 Evas_Engine_Info_GL_SDL *in;
27 in = (Evas_Engine_Info_GL_SDL *)info;
32 eng_setup(Evas *e, void *in)
35 Evas_Engine_Info_GL_SDL *info;
37 info = (Evas_Engine_Info_GL_SDL *)in;
39 SDL_Init(SDL_INIT_NOPARACHUTE);
41 if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0)
43 ERR("SDL_Init failed with %s", SDL_GetError());
48 re = _sdl_output_setup(e->output.w, e->output.h,
49 info->flags.fullscreen,
52 e->engine.data.output = re;
53 if (!e->engine.data.output)
56 e->engine.func = &func;
57 e->engine.data.context = e->engine.func->context_new(e->engine.data.output);
63 eng_output_free(void *data)
67 re = (Render_Engine *)data;
68 evas_gl_common_context_free(re->gl_context);
71 evas_common_font_shutdown();
72 evas_common_image_shutdown();
74 SDL_QuitSubSystem(SDL_INIT_VIDEO);
78 eng_output_resize(void *data, int w, int h)
83 re = (Render_Engine *)data;
87 if(SDL_GetVideoSurface()->flags & SDL_RESIZABLE)
89 surface = SDL_SetVideoMode(w, h, 32, EVAS_SDL_GL_FLAG
90 | (re->info->flags.fullscreen ? SDL_FULLSCREEN : 0)
91 | (re->info->flags.noframe ? SDL_NOFRAME : 0));
94 ERR("Unable to change the resolution to : %ix%i", w, h);
100 evas_gl_common_context_resize(re->gl_context, w, h, re->gl_context->rot);
104 eng_output_tile_size_set(void *data, int w __UNUSED__, int h __UNUSED__)
106 // Render_Engine *re;
108 // re = (Render_Engine *)data;
112 eng_output_redraws_rect_add(void *data, int x, int y, int w, int h)
116 re = (Render_Engine *)data;
117 evas_gl_common_context_resize(re->gl_context, re->w, re->h, re->gl_context->rot);
118 /* smple bounding box */
119 if (!re->draw.redraw)
124 re->draw.x2 = x + w - 1;
125 re->draw.y2 = y + h - 1;
129 re->draw.x2 = re->w - 1;
130 re->draw.y2 = re->h - 1;
135 if (x < re->draw.x1) re->draw.x1 = x;
136 if (y < re->draw.y1) re->draw.y1 = y;
137 if ((x + w - 1) > re->draw.x2) re->draw.x2 = x + w - 1;
138 if ((y + h - 1) > re->draw.y2) re->draw.y2 = y + h - 1;
144 eng_output_redraws_rect_del(void *data, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__)
146 // Render_Engine *re;
148 // re = (Render_Engine *)data;
152 eng_output_redraws_clear(void *data)
156 re = (Render_Engine *)data;
158 // INF("GL: finish update cycle!");
161 /* at least the nvidia drivers are so abysmal that copying from the backbuffer
162 * to the front using glCopyPixels() that you literally can WATCH it draw the
163 * pixels slowly across the screen with a window update taking multiple
164 * seconds - so workaround by doing a full buffer render as frankly GL isn't
165 * up to doing anything that isn't done by quake (etc.)
167 #define SLOW_GL_COPY_RECT 1
168 /* vsync games - not for now though */
169 //#define VSYNC_TO_SCREEN 1
172 eng_output_redraws_next_update_get(void *data, int *x, int *y, int *w, int *h, int *cx, int *cy, int *cw, int *ch)
176 re = (Render_Engine *)data;
177 evas_gl_common_context_flush(re->gl_context);
178 evas_gl_common_context_newframe(re->gl_context);
179 /* get the upate rect surface - return engine data as dummy */
180 if (!re->draw.redraw)
182 // printf("GL: NO updates!\n");
185 // printf("GL: update....!\n");
186 #ifdef SLOW_GL_COPY_RECT
187 /* if any update - just return the whole canvas - works with swap
198 /* 1 update - INCREDIBLY SLOW if combined with swap_rect in flush. a gl
199 * problem where there just is no hardware path for somethnig that
200 * obviously SHOULD be there */
201 /* only 1 update to minimise gl context games and rendering multiple update
202 * regions as evas does with other engines
204 if (x) *x = re->draw.x1;
205 if (y) *y = re->draw.y1;
206 if (w) *w = re->draw.x2 - re->draw.x1 + 1;
207 if (h) *h = re->draw.y2 - re->draw.y1 + 1;
208 if (cx) *cx = re->draw.x1;
209 if (cy) *cy = re->draw.y1;
210 if (cw) *cw = re->draw.x2 - re->draw.x1 + 1;
211 if (ch) *ch = re->draw.y2 - re->draw.y1 + 1;
213 // clear buffer. only needed for dest alpha
214 // glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
215 // glClear(GL_COLOR_BUFFER_BIT);
216 //x// printf("frame -> new\n");
217 return re->gl_context->def_surface;
221 eng_output_redraws_next_update_push(void *data, void *surface __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__)
225 re = (Render_Engine *)data;
226 /* put back update surface.. in this case just unflag redraw */
229 evas_gl_common_context_flush(re->gl_context);
230 //x// printf("frame -> push\n");
234 eng_output_flush(void *data)
238 re = (Render_Engine *)data;
239 if (!re->draw.drew) return;
240 //x// printf("frame -> flush\n");
244 #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
246 eglSwapBuffers(re->egl_disp, re->egl_surface[0]);
248 glXSwapBuffers(re->win->disp, re->win);
251 SDL_GL_SwapBuffers();
256 eng_output_idle_flush(void *data)
260 re = (Render_Engine *)data;
264 eng_output_dump(void *data)
268 re = (Render_Engine *)data;
269 evas_common_image_image_all_unload();
270 evas_common_font_font_all_unload();
271 evas_gl_common_image_all_unload(re->gl_context);
275 eng_context_cutout_add(void *data, void *context, int x, int y, int w, int h)
277 // Render_Engine *re;
279 // re = (Render_Engine *)data;
280 // re->gl_context->dc = context;
281 evas_common_draw_context_add_cutout(context, x, y, w, h);
285 eng_context_cutout_clear(void *data, void *context)
287 // Render_Engine *re;
289 // re = (Render_Engine *)data;
290 // re->gl_context->dc = context;
291 evas_common_draw_context_clear_cutouts(context);
295 eng_rectangle_draw(void *data, void *context, void *surface, int x, int y, int w, int h)
299 re = (Render_Engine *)data;
300 evas_gl_common_context_target_surface_set(re->gl_context, surface);
301 re->gl_context->dc = context;
302 evas_gl_common_rect_draw(re->gl_context, x, y, w, h);
306 eng_line_draw(void *data, void *context, void *surface, int x1, int y1, int x2, int y2)
310 re = (Render_Engine *)data;
311 evas_gl_common_context_target_surface_set(re->gl_context, surface);
312 re->gl_context->dc = context;
313 evas_gl_common_line_draw(re->gl_context, x1, y1, x2, y2);
317 eng_polygon_point_add(void *data, void *context __UNUSED__, void *polygon, int x, int y)
321 re = (Render_Engine *)data;
322 return evas_gl_common_poly_point_add(polygon, x, y);
326 eng_polygon_points_clear(void *data, void *context __UNUSED__, void *polygon)
330 re = (Render_Engine *)data;
331 return evas_gl_common_poly_points_clear(polygon);
335 eng_polygon_draw(void *data, void *context, void *surface, void *polygon, int x, int y)
339 re = (Render_Engine *)data;
340 evas_gl_common_context_target_surface_set(re->gl_context, surface);
341 re->gl_context->dc = context;
342 evas_gl_common_poly_draw(re->gl_context, polygon, x, y);
346 eng_image_alpha_get(void *data, void *image)
348 // Render_Engine *re;
351 // re = (Render_Engine *)data;
352 if (!image) return 1;
358 eng_image_colorspace_get(void *data, void *image)
360 // Render_Engine *re;
363 // re = (Render_Engine *)data;
364 if (!image) return EVAS_COLORSPACE_ARGB8888;
370 eng_image_alpha_set(void *data, void *image, int has_alpha)
375 re = (Render_Engine *)data;
376 if (!image) return NULL;
380 im->alpha = has_alpha;
383 /* FIXME: can move to gl_common */
384 if (im->cs.space != EVAS_COLORSPACE_ARGB8888) return im;
385 if ((has_alpha) && (im->im->cache_entry.flags.alpha)) return image;
386 else if ((!has_alpha) && (!im->im->cache_entry.flags.alpha)) return image;
387 if (im->references > 1)
389 Evas_GL_Image *im_new;
391 im_new = evas_gl_common_image_new_from_copied_data(im->gc, im->im->cache_entry.w, im->im->cache_entry.h, im->im->image.data,
392 eng_image_alpha_get(data, image),
393 eng_image_colorspace_get(data, image));
394 if (!im_new) return im;
395 evas_gl_common_image_free(im);
399 evas_gl_common_image_dirty(im, 0, 0, 0, 0);
400 im->im->cache_entry.flags.alpha = has_alpha ? 1 : 0;
405 eng_image_border_set(void *data, void *image, int l __UNUSED__, int r __UNUSED__, int t __UNUSED__, int b __UNUSED__)
407 // Render_Engine *re;
409 // re = (Render_Engine *)data;
414 eng_image_border_get(void *data, void *image __UNUSED__, int *l __UNUSED__, int *r __UNUSED__, int *t __UNUSED__, int *b __UNUSED__)
416 // Render_Engine *re;
418 // re = (Render_Engine *)data;
422 eng_image_comment_get(void *data, void *image, char *key __UNUSED__)
424 // Render_Engine *re;
427 // re = (Render_Engine *)data;
428 if (!image) return NULL;
430 if (!im->im) return NULL;
431 return im->im->info.comment;
435 eng_image_format_get(void *data, void *image)
437 // Render_Engine *re;
440 // re = (Render_Engine *)data;
446 eng_image_colorspace_set(void *data, void *image, int cspace)
451 re = (Render_Engine *)data;
454 if (im->native.data) return;
455 /* FIXME: can move to gl_common */
456 if (im->cs.space == cspace) return;
457 evas_cache_image_colorspace(&im->im->cache_entry, cspace);
460 case EVAS_COLORSPACE_ARGB8888:
463 if (!im->cs.no_free) free(im->cs.data);
468 case EVAS_COLORSPACE_YCBCR422P601_PL:
469 case EVAS_COLORSPACE_YCBCR422P709_PL:
470 case EVAS_COLORSPACE_YCBCR422601_PL:
471 case EVAS_COLORSPACE_YCBCR420NV12601_PL:
472 case EVAS_COLORSPACE_YCBCR420TM12601_PL:
473 if (im->tex) evas_gl_common_texture_free(im->tex);
477 if (!im->cs.no_free) free(im->cs.data);
479 im->cs.data = calloc(1, im->im->cache_entry.h * sizeof(unsigned char *) * 2);
486 im->cs.space = cspace;
489 /////////////////////////////////////////////////////////////////////////
492 typedef struct _Native Native;
496 Evas_Native_Surface ns;
498 #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
499 EGLSurface egl_surface;
504 _native_bind_cb(void *data, void *image)
509 _native_unbind_cb(void *data, void *image)
514 _native_free_cb(void *data, void *image)
519 eng_image_native_set(void *data, void *image, void *native)
525 eng_image_native_get(void *data, void *image)
532 /////////////////////////////////////////////////////////////////////////
535 eng_image_load(void *data, const char *file, const char *key, int *error, Evas_Image_Load_Opts *lo)
539 re = (Render_Engine *)data;
540 *error = EVAS_LOAD_ERROR_NONE;
541 return evas_gl_common_image_load(re->gl_context, file, key, lo, error);
545 eng_image_new_from_data(void *data, int w, int h, DATA32 *image_data, int alpha, int cspace)
549 re = (Render_Engine *)data;
550 return evas_gl_common_image_new_from_data(re->gl_context, w, h, image_data, alpha, cspace);
554 eng_image_new_from_copied_data(void *data, int w, int h, DATA32 *image_data, int alpha, int cspace)
558 re = (Render_Engine *)data;
559 return evas_gl_common_image_new_from_copied_data(re->gl_context, w, h, image_data, alpha, cspace);
563 eng_image_free(void *data, void *image)
567 re = (Render_Engine *)data;
569 evas_gl_common_image_free(image);
573 eng_image_size_get(void *data, void *image, int *w, int *h)
575 // Render_Engine *re;
577 // re = (Render_Engine *)data;
584 if (w) *w = ((Evas_GL_Image *)image)->w;
585 if (h) *h = ((Evas_GL_Image *)image)->h;
589 eng_image_size_set(void *data, void *image, int w, int h)
592 Evas_GL_Image *im = image;
593 Evas_GL_Image *im_old;
595 re = (Render_Engine *)data;
596 if (!im) return NULL;
605 switch (eng_image_colorspace_get(data, image))
607 case EVAS_COLORSPACE_YCBCR422P601_PL:
608 case EVAS_COLORSPACE_YCBCR422P709_PL:
609 case EVAS_COLORSPACE_YCBCR422601_PL:
610 case EVAS_COLORSPACE_YCBCR420NV12601_PL:
611 case EVAS_COLORSPACE_YCBCR420TM12601_PL:
616 if ((im_old) && (im_old->im->cache_entry.w == w) && (im_old->im->cache_entry.h == h))
620 im = evas_gl_common_image_new(re->gl_context, w, h,
621 eng_image_alpha_get(data, image),
622 eng_image_colorspace_get(data, image));
624 evas_common_load_image_data_from_file(im_old->im);
625 if (im_old->im->image->data)
627 evas_common_blit_rectangle(im_old->im, im->im, 0, 0, w, h, 0, 0);
628 evas_common_cpu_end_opt();
631 evas_gl_common_image_free(im_old);
634 im = evas_gl_common_image_new(re->gl_context, w, h, 1, EVAS_COLORSPACE_ARGB8888);
639 eng_image_dirty_region(void *data, void *image, int x, int y, int w, int h)
642 Evas_GL_Image *im = image;
644 re = (Render_Engine *)data;
645 if (!image) return NULL;
646 if (im->native.data) return image;
647 evas_gl_common_image_dirty(image, x, y, w, h);
652 eng_image_data_get(void *data, void *image, int to_write, DATA32 **image_data, int *err)
658 re = (Render_Engine *)data;
662 if (err) *err = EVAS_LOAD_ERROR_GENERIC;
669 if (err) *err = EVAS_LOAD_ERROR_NONE;
672 error = evas_cache_image_load_data(&im->im->cache_entry);
673 switch (im->cs.space)
675 case EVAS_COLORSPACE_ARGB8888:
678 if (im->references > 1)
680 Evas_GL_Image *im_new;
682 im_new = evas_gl_common_image_new_from_copied_data(im->gc, im->im->cache_entry.w, im->im->cache_entry.h, im->im->image.data,
683 eng_image_alpha_get(data, image),
684 eng_image_colorspace_get(data, image));
688 if (err) *err = error;
691 evas_gl_common_image_free(im);
695 evas_gl_common_image_dirty(im, 0, 0, 0, 0);
697 *image_data = im->im->image.data;
699 case EVAS_COLORSPACE_YCBCR422P601_PL:
700 case EVAS_COLORSPACE_YCBCR422P709_PL:
701 case EVAS_COLORSPACE_YCBCR422601_PL:
702 case EVAS_COLORSPACE_YCBCR420NV12601_PL:
703 case EVAS_COLORSPACE_YCBCR420TM12601_PL:
704 *image_data = im->cs.data;
710 if (err) *err = error;
715 eng_image_data_put(void *data, void *image, DATA32 *image_data)
718 Evas_GL_Image *im, *im2;
720 re = (Render_Engine *)data;
721 if (!image) return NULL;
723 if (im->native.data) return image;
724 switch (im->cs.space)
726 case EVAS_COLORSPACE_ARGB8888:
727 if (image_data != im->im->image.data)
731 w = im->im->cache_entry.w;
732 h = im->im->cache_entry.h;
733 im2 = eng_image_new_from_data(data, w, h, image_data,
734 eng_image_alpha_get(data, image),
735 eng_image_colorspace_get(data, image));
737 evas_gl_common_image_free(im);
741 case EVAS_COLORSPACE_YCBCR422P601_PL:
742 case EVAS_COLORSPACE_YCBCR422P709_PL:
743 case EVAS_COLORSPACE_YCBCR422601_PL:
744 case EVAS_COLORSPACE_YCBCR420NV12601_PL:
745 case EVAS_COLORSPACE_YCBCR420TM12601_PL:
746 if (image_data != im->cs.data)
750 if (!im->cs.no_free) free(im->cs.data);
752 im->cs.data = image_data;
759 /* hmmm - but if we wrote... why bother? */
760 evas_gl_common_image_dirty(im, 0, 0, 0, 0);
765 eng_image_data_preload_request(void *data __UNUSED__, void *image, const void *target)
767 Evas_GL_Image *gim = image;
771 if (gim->native.data) return;
772 im = (RGBA_Image *)gim->im;
774 evas_cache_image_preload_data(&im->cache_entry, target);
778 eng_image_data_preload_cancel(void *data __UNUSED__, void *image, const void *target)
780 Evas_GL_Image *gim = image;
784 if (gim->native.data) return;
785 im = (RGBA_Image *)gim->im;
787 evas_cache_image_preload_cancel(&im->cache_entry, target);
791 eng_image_draw(void *data, void *context, void *surface, void *image, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h, int smooth)
795 re = (Render_Engine *)data;
797 evas_gl_common_context_target_surface_set(re->gl_context, surface);
798 re->gl_context->dc = context;
799 evas_gl_common_image_draw(re->gl_context, image,
800 src_x, src_y, src_w, src_h,
801 dst_x, dst_y, dst_w, dst_h,
806 eng_image_scale_hint_set(void *data __UNUSED__, void *image, int hint)
811 eng_image_map_draw(void *data __UNUSED__, void *context, void *surface, void *image, int npoints, RGBA_Map_Point *p, int smooth, int level)
815 re = (Render_Engine *)data;
816 evas_gl_common_context_target_surface_set(re->gl_context, surface);
817 re->gl_context->dc = context;
818 evas_gl_common_image_map_draw(re->gl_context, image, npoints, p, smooth, level);
822 eng_image_map_surface_new(void *data __UNUSED__, int w, int h, int alpha)
826 re = (Render_Engine *)data;
827 return evas_gl_common_image_surface_new(re->gl_context, w, h, alpha);
831 eng_image_map_surface_free(void *data __UNUSED__, void *surface)
833 evas_gl_common_image_free(surface);
837 eng_image_scale_hint_get(void *data __UNUSED__, void *image)
839 return EVAS_IMAGE_SCALE_HINT_NONE;
843 eng_font_draw(void *data, void *context, void *surface, Evas_Font_Set *font, int x, int y, int w __UNUSED__, int h __UNUSED__, int ow __UNUSED__, int oh __UNUSED__, const Evas_Text_Props *intl_props)
847 re = (Render_Engine *)data;
848 evas_gl_common_context_target_surface_set(re->gl_context, surface);
849 re->gl_context->dc = context;
851 // FIXME: put im into context so we can free it
852 static RGBA_Image *im = NULL;
855 im = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get());
856 im->cache_entry.w = re->w;
857 im->cache_entry.h = re->h;
858 evas_common_draw_context_font_ext_set(context,
860 evas_gl_font_texture_new,
861 evas_gl_font_texture_free,
862 evas_gl_font_texture_draw);
863 evas_common_font_draw(im, context, (RGBA_Font *) font, x, y,
865 evas_common_draw_context_font_ext_set(context,
874 eng_canvas_alpha_get(void *data __UNUSED__, void *info __UNUSED__)
876 // FIXME: support ARGB gl targets!!!
881 eng_image_load_error_get(void *data __UNUSED__, void *image)
885 if (!image) return EVAS_LOAD_ERROR_NONE;
887 return im->im->cache_entry.load_error;
892 module_open(Evas_Module *em)
895 if (!evas_gl_common_module_open()) return 0;
896 /* get whatever engine module we inherit from */
897 if (!_evas_module_engine_inherit(&pfunc, "software_generic")) return 0;
898 if (_evas_engine_GL_SDL_log_dom < 0)
899 _evas_engine_GL_SDL_log_dom = eina_log_domain_register
900 ("evas-gl_sdl", EVAS_DEFAULT_LOG_COLOR);
901 if (_evas_engine_GL_SDL_log_dom < 0)
903 EINA_LOG_ERR("Can not create a module log domain.");
906 /* store it for later use */
908 /* now to override methods */
909 #define ORD(f) EVAS_API_OVERRIDE(f, &func, eng_)
913 ORD(canvas_alpha_get);
916 ORD(output_tile_size_set);
917 ORD(output_redraws_rect_add);
918 ORD(output_redraws_rect_del);
919 ORD(output_redraws_clear);
920 ORD(output_redraws_next_update_get);
921 ORD(output_redraws_next_update_push);
922 ORD(context_cutout_add);
923 ORD(context_cutout_clear);
925 ORD(output_idle_flush);
929 ORD(polygon_point_add);
930 ORD(polygon_points_clear);
934 ORD(image_new_from_data);
935 ORD(image_new_from_copied_data);
939 ORD(image_dirty_region);
942 ORD(image_data_preload_request);
943 ORD(image_data_preload_cancel);
944 ORD(image_alpha_set);
945 ORD(image_alpha_get);
946 ORD(image_border_set);
947 ORD(image_border_get);
949 ORD(image_comment_get);
950 ORD(image_format_get);
951 ORD(image_colorspace_set);
952 ORD(image_colorspace_get);
953 ORD(image_native_set);
954 ORD(image_native_get);
955 #if 0 // filtering disabled
956 // ORD(image_draw_filtered);
957 // ORD(image_filtered_get);
958 // ORD(image_filtered_save);
959 // ORD(image_filtered_free);
963 ORD(image_scale_hint_set);
964 ORD(image_scale_hint_get);
967 ORD(image_map_surface_new);
968 ORD(image_map_surface_free);
970 // ORD(image_content_hint_set);
971 // ORD(image_content_hint_get);
973 // ORD(image_cache_flush);
974 // ORD(image_cache_set);
975 // ORD(image_cache_get);
977 // ORD(gl_surface_create);
978 // ORD(gl_surface_destroy);
979 // ORD(gl_context_create);
980 // ORD(gl_context_destroy);
981 // ORD(gl_make_current);
982 // ORD(gl_proc_address_get);
983 // ORD(gl_native_surface_get);
987 ORD(image_load_error_get);
989 /* now advertise out own api */
990 em->functions = (void *)(&func);
995 module_close(Evas_Module *em)
997 eina_log_domain_unregister(_evas_engine_GL_SDL_log_dom);
998 evas_gl_common_module_close();
1001 static Evas_Module_Api evas_modapi =
1003 EVAS_MODULE_API_VERSION,
1012 EVAS_MODULE_DEFINE(EVAS_MODULE_TYPE_ENGINE, engine, gl_sdl);
1014 #ifndef EVAS_STATIC_BUILD_GL_SDL
1015 EVAS_EINA_MODULE_DEFINE(engine, gl_sdl);
1019 _sdl_output_setup (int w, int h, int fullscreen, int noframe)
1021 Render_Engine *re = calloc(1, sizeof(Render_Engine));
1022 SDL_Surface *surface;
1023 int context_attrs[3];
1024 int config_attrs[20];
1025 int major_version, minor_version;
1028 /* if we haven't initialized - init (automatic abort if already done) */
1029 evas_common_cpu_init();
1030 evas_common_blend_init();
1031 evas_common_image_init();
1032 evas_common_convert_init();
1033 evas_common_scale_init();
1034 evas_common_rectangle_init();
1035 evas_common_polygon_init();
1036 evas_common_line_init();
1037 evas_common_font_init();
1038 evas_common_draw_init();
1039 evas_common_tilebuf_init();
1041 if (w <= 0) w = 640;
1042 if (h <= 0) h = 480;
1044 /* GL Initialization */
1045 #ifdef HAVE_SDL_GL_CONTEXT_VERSION
1046 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
1047 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
1049 SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
1050 SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
1051 SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
1052 SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
1053 SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
1054 SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 0);
1056 surface = SDL_SetVideoMode(w, h, 32, EVAS_SDL_GL_FLAG
1057 | (fullscreen ? SDL_FULLSCREEN : 0)
1058 | (noframe ? SDL_NOFRAME : 0));
1062 CRIT("SDL_SetVideoMode [ %i x %i x 32 ] failed. %s", w, h, SDL_GetError());
1067 INF("Screen Depth: %d, Vendor: '%s', Renderer: '%s', Version: '%s'", SDL_GetVideoSurface()->format->BitsPerPixel, glGetString(GL_VENDOR), glGetString(GL_RENDERER), glGetString(GL_VERSION));
1069 re->gl_context = evas_gl_common_context_new();
1070 if (!re->gl_context)
1075 evas_gl_common_context_use(re->gl_context);
1076 evas_gl_common_context_resize(re->gl_context, w, h, re->gl_context->rot);
1078 /* End GL Initialization */