1 #include "evas_common.h" /* Also includes international specific stuff */
2 #include "evas_engine.h"
4 static void* _sdl_output_setup (int w, int h, int fullscreen, int noframe);
6 int _evas_engine_GL_SDL_log_dom = -1;
7 /* function tables - filled in later (func and parent func) */
8 static Evas_Func func, pfunc;
13 Evas_Engine_Info_GL_SDL *info;
15 info = calloc(1, sizeof(Evas_Engine_Info_GL_SDL));
16 if (!info) return NULL;
17 info->magic.magic = rand();
22 eng_info_free(Evas *e __UNUSED__, void *info)
24 Evas_Engine_Info_GL_SDL *in;
25 in = (Evas_Engine_Info_GL_SDL *)info;
30 eng_setup(Evas *e, void *in)
33 Evas_Engine_Info_GL_SDL *info;
35 info = (Evas_Engine_Info_GL_SDL *)in;
37 SDL_Init(SDL_INIT_NOPARACHUTE);
39 if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0)
41 ERR("SDL_Init failed with %s", SDL_GetError());
46 re = _sdl_output_setup(e->output.w, e->output.h,
47 info->flags.fullscreen,
50 e->engine.data.output = re;
51 if (!e->engine.data.output)
54 e->engine.func = &func;
55 e->engine.data.context = e->engine.func->context_new(e->engine.data.output);
61 eng_output_free(void *data)
65 re = (Render_Engine *)data;
66 evas_gl_common_context_free(re->gl_context);
69 evas_common_font_shutdown();
70 evas_common_image_shutdown();
72 SDL_QuitSubSystem(SDL_INIT_VIDEO);
76 eng_output_resize(void *data, int w, int h)
81 re = (Render_Engine *)data;
85 if(SDL_GetVideoSurface()->flags & SDL_RESIZABLE)
87 surface = SDL_SetVideoMode(w, h, 32, EVAS_SDL_GL_FLAG
88 | (re->info->flags.fullscreen ? SDL_FULLSCREEN : 0)
89 | (re->info->flags.noframe ? SDL_NOFRAME : 0));
92 ERR("Unable to change the resolution to : %ix%i", w, h);
98 evas_gl_common_context_resize(re->gl_context, w, h, re->gl_context->rot);
102 eng_output_tile_size_set(void *data, int w __UNUSED__, int h __UNUSED__)
104 // Render_Engine *re;
106 // re = (Render_Engine *)data;
110 eng_output_redraws_rect_add(void *data, int x, int y, int w, int h)
114 re = (Render_Engine *)data;
115 evas_gl_common_context_resize(re->gl_context, re->w, re->h, re->gl_context->rot);
116 /* smple bounding box */
117 if (!re->draw.redraw)
122 re->draw.x2 = x + w - 1;
123 re->draw.y2 = y + h - 1;
127 re->draw.x2 = re->w - 1;
128 re->draw.y2 = re->h - 1;
133 if (x < re->draw.x1) re->draw.x1 = x;
134 if (y < re->draw.y1) re->draw.y1 = y;
135 if ((x + w - 1) > re->draw.x2) re->draw.x2 = x + w - 1;
136 if ((y + h - 1) > re->draw.y2) re->draw.y2 = y + h - 1;
142 eng_output_redraws_rect_del(void *data, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__)
144 // Render_Engine *re;
146 // re = (Render_Engine *)data;
150 eng_output_redraws_clear(void *data)
154 re = (Render_Engine *)data;
156 // INF("GL: finish update cycle!");
159 /* at least the nvidia drivers are so abysmal that copying from the backbuffer
160 * to the front using glCopyPixels() that you literally can WATCH it draw the
161 * pixels slowly across the screen with a window update taking multiple
162 * seconds - so workaround by doing a full buffer render as frankly GL isn't
163 * up to doing anything that isn't done by quake (etc.)
165 #define SLOW_GL_COPY_RECT 1
166 /* vsync games - not for now though */
167 //#define VSYNC_TO_SCREEN 1
170 eng_output_redraws_next_update_get(void *data, int *x, int *y, int *w, int *h, int *cx, int *cy, int *cw, int *ch)
174 re = (Render_Engine *)data;
175 evas_gl_common_context_flush(re->gl_context);
176 evas_gl_common_context_newframe(re->gl_context);
177 /* get the upate rect surface - return engine data as dummy */
178 if (!re->draw.redraw)
180 // printf("GL: NO updates!\n");
183 // printf("GL: update....!\n");
184 #ifdef SLOW_GL_COPY_RECT
185 /* if any update - just return the whole canvas - works with swap
196 /* 1 update - INCREDIBLY SLOW if combined with swap_rect in flush. a gl
197 * problem where there just is no hardware path for somethnig that
198 * obviously SHOULD be there */
199 /* only 1 update to minimise gl context games and rendering multiple update
200 * regions as evas does with other engines
202 if (x) *x = re->draw.x1;
203 if (y) *y = re->draw.y1;
204 if (w) *w = re->draw.x2 - re->draw.x1 + 1;
205 if (h) *h = re->draw.y2 - re->draw.y1 + 1;
206 if (cx) *cx = re->draw.x1;
207 if (cy) *cy = re->draw.y1;
208 if (cw) *cw = re->draw.x2 - re->draw.x1 + 1;
209 if (ch) *ch = re->draw.y2 - re->draw.y1 + 1;
211 // clear buffer. only needed for dest alpha
212 // glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
213 // glClear(GL_COLOR_BUFFER_BIT);
214 //x// printf("frame -> new\n");
215 return re->gl_context->def_surface;
219 eng_output_redraws_next_update_push(void *data, void *surface __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__)
223 re = (Render_Engine *)data;
224 /* put back update surface.. in this case just unflag redraw */
227 evas_gl_common_context_flush(re->gl_context);
228 //x// printf("frame -> push\n");
232 eng_output_flush(void *data)
236 re = (Render_Engine *)data;
237 if (!re->draw.drew) return;
238 //x// printf("frame -> flush\n");
242 #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
244 eglSwapBuffers(re->egl_disp, re->egl_surface[0]);
246 glXSwapBuffers(re->win->disp, re->win);
249 SDL_GL_SwapBuffers();
254 eng_output_idle_flush(void *data)
258 re = (Render_Engine *)data;
262 eng_output_dump(void *data)
266 re = (Render_Engine *)data;
267 evas_common_image_image_all_unload();
268 evas_common_font_font_all_unload();
269 evas_gl_common_image_all_unload(re->gl_context);
273 eng_context_cutout_add(void *data, void *context, int x, int y, int w, int h)
275 // Render_Engine *re;
277 // re = (Render_Engine *)data;
278 // re->gl_context->dc = context;
279 evas_common_draw_context_add_cutout(context, x, y, w, h);
283 eng_context_cutout_clear(void *data, void *context)
285 // Render_Engine *re;
287 // re = (Render_Engine *)data;
288 // re->gl_context->dc = context;
289 evas_common_draw_context_clear_cutouts(context);
293 eng_rectangle_draw(void *data, void *context, void *surface, int x, int y, int w, int h)
297 re = (Render_Engine *)data;
298 evas_gl_common_context_target_surface_set(re->gl_context, surface);
299 re->gl_context->dc = context;
300 evas_gl_common_rect_draw(re->gl_context, x, y, w, h);
304 eng_line_draw(void *data, void *context, void *surface, int x1, int y1, int x2, int y2)
308 re = (Render_Engine *)data;
309 evas_gl_common_context_target_surface_set(re->gl_context, surface);
310 re->gl_context->dc = context;
311 evas_gl_common_line_draw(re->gl_context, x1, y1, x2, y2);
315 eng_polygon_point_add(void *data, void *context __UNUSED__, void *polygon, int x, int y)
319 re = (Render_Engine *)data;
320 return evas_gl_common_poly_point_add(polygon, x, y);
324 eng_polygon_points_clear(void *data, void *context __UNUSED__, void *polygon)
328 re = (Render_Engine *)data;
329 return evas_gl_common_poly_points_clear(polygon);
333 eng_polygon_draw(void *data, void *context, void *surface, void *polygon, int x, int y)
337 re = (Render_Engine *)data;
338 evas_gl_common_context_target_surface_set(re->gl_context, surface);
339 re->gl_context->dc = context;
340 evas_gl_common_poly_draw(re->gl_context, polygon, x, y);
344 eng_image_alpha_get(void *data, void *image)
346 // Render_Engine *re;
349 // re = (Render_Engine *)data;
350 if (!image) return 1;
356 eng_image_colorspace_get(void *data, void *image)
358 // Render_Engine *re;
361 // re = (Render_Engine *)data;
362 if (!image) return EVAS_COLORSPACE_ARGB8888;
368 eng_image_alpha_set(void *data, void *image, int has_alpha)
373 re = (Render_Engine *)data;
374 if (!image) return NULL;
378 im->alpha = has_alpha;
381 /* FIXME: can move to gl_common */
382 if (im->cs.space != EVAS_COLORSPACE_ARGB8888) return im;
383 if ((has_alpha) && (im->im->cache_entry.flags.alpha)) return image;
384 else if ((!has_alpha) && (!im->im->cache_entry.flags.alpha)) return image;
385 if (im->references > 1)
387 Evas_GL_Image *im_new;
389 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,
390 eng_image_alpha_get(data, image),
391 eng_image_colorspace_get(data, image));
392 if (!im_new) return im;
393 evas_gl_common_image_free(im);
397 evas_gl_common_image_dirty(im, 0, 0, 0, 0);
398 im->im->cache_entry.flags.alpha = has_alpha ? 1 : 0;
403 eng_image_border_set(void *data, void *image, int l __UNUSED__, int r __UNUSED__, int t __UNUSED__, int b __UNUSED__)
405 // Render_Engine *re;
407 // re = (Render_Engine *)data;
412 eng_image_border_get(void *data, void *image __UNUSED__, int *l __UNUSED__, int *r __UNUSED__, int *t __UNUSED__, int *b __UNUSED__)
414 // Render_Engine *re;
416 // re = (Render_Engine *)data;
420 eng_image_comment_get(void *data, void *image, char *key __UNUSED__)
422 // Render_Engine *re;
425 // re = (Render_Engine *)data;
426 if (!image) return NULL;
428 if (!im->im) return NULL;
429 return im->im->info.comment;
433 eng_image_format_get(void *data, void *image)
435 // Render_Engine *re;
438 // re = (Render_Engine *)data;
444 eng_image_colorspace_set(void *data, void *image, int cspace)
449 re = (Render_Engine *)data;
452 if (im->native.data) return;
453 /* FIXME: can move to gl_common */
454 if (im->cs.space == cspace) return;
455 evas_cache_image_colorspace(&im->im->cache_entry, cspace);
458 case EVAS_COLORSPACE_ARGB8888:
461 if (!im->cs.no_free) free(im->cs.data);
466 case EVAS_COLORSPACE_YCBCR422P601_PL:
467 case EVAS_COLORSPACE_YCBCR422P709_PL:
468 case EVAS_COLORSPACE_YCBCR422601_PL:
469 case EVAS_COLORSPACE_YCBCR420NV12601_PL:
470 case EVAS_COLORSPACE_YCBCR420TM12601_PL:
471 if (im->tex) evas_gl_common_texture_free(im->tex);
475 if (!im->cs.no_free) free(im->cs.data);
477 im->cs.data = calloc(1, im->im->cache_entry.h * sizeof(unsigned char *) * 2);
484 im->cs.space = cspace;
487 /////////////////////////////////////////////////////////////////////////
490 typedef struct _Native Native;
494 Evas_Native_Surface ns;
496 #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
497 EGLSurface egl_surface;
502 _native_bind_cb(void *data, void *image)
507 _native_unbind_cb(void *data, void *image)
512 _native_free_cb(void *data, void *image)
517 eng_image_native_set(void *data, void *image, void *native)
523 eng_image_native_get(void *data, void *image)
530 /////////////////////////////////////////////////////////////////////////
533 eng_image_load(void *data, const char *file, const char *key, int *error, Evas_Image_Load_Opts *lo)
537 re = (Render_Engine *)data;
538 *error = EVAS_LOAD_ERROR_NONE;
539 return evas_gl_common_image_load(re->gl_context, file, key, lo, error);
543 eng_image_new_from_data(void *data, int w, int h, DATA32 *image_data, int alpha, int cspace)
547 re = (Render_Engine *)data;
548 return evas_gl_common_image_new_from_data(re->gl_context, w, h, image_data, alpha, cspace);
552 eng_image_new_from_copied_data(void *data, int w, int h, DATA32 *image_data, int alpha, int cspace)
556 re = (Render_Engine *)data;
557 return evas_gl_common_image_new_from_copied_data(re->gl_context, w, h, image_data, alpha, cspace);
561 eng_image_free(void *data, void *image)
565 re = (Render_Engine *)data;
567 evas_gl_common_image_free(image);
571 eng_image_size_get(void *data, void *image, int *w, int *h)
573 // Render_Engine *re;
575 // re = (Render_Engine *)data;
582 if (w) *w = ((Evas_GL_Image *)image)->w;
583 if (h) *h = ((Evas_GL_Image *)image)->h;
587 eng_image_size_set(void *data, void *image, int w, int h)
590 Evas_GL_Image *im = image;
591 Evas_GL_Image *im_old;
593 re = (Render_Engine *)data;
594 if (!im) return NULL;
603 switch (eng_image_colorspace_get(data, image))
605 case EVAS_COLORSPACE_YCBCR422P601_PL:
606 case EVAS_COLORSPACE_YCBCR422P709_PL:
607 case EVAS_COLORSPACE_YCBCR422601_PL:
608 case EVAS_COLORSPACE_YCBCR420NV12601_PL:
609 case EVAS_COLORSPACE_YCBCR420TM12601_PL:
614 if ((im_old) && (im_old->im->cache_entry.w == w) && (im_old->im->cache_entry.h == h))
618 im = evas_gl_common_image_new(re->gl_context, w, h,
619 eng_image_alpha_get(data, image),
620 eng_image_colorspace_get(data, image));
622 evas_common_load_image_data_from_file(im_old->im);
623 if (im_old->im->image->data)
625 evas_common_blit_rectangle(im_old->im, im->im, 0, 0, w, h, 0, 0);
626 evas_common_cpu_end_opt();
629 evas_gl_common_image_free(im_old);
632 im = evas_gl_common_image_new(re->gl_context, w, h, 1, EVAS_COLORSPACE_ARGB8888);
637 eng_image_dirty_region(void *data, void *image, int x, int y, int w, int h)
640 Evas_GL_Image *im = image;
642 re = (Render_Engine *)data;
643 if (!image) return NULL;
644 if (im->native.data) return image;
645 evas_gl_common_image_dirty(image, x, y, w, h);
650 eng_image_data_get(void *data, void *image, int to_write, DATA32 **image_data, int *err)
656 re = (Render_Engine *)data;
660 if (err) *err = EVAS_LOAD_ERROR_GENERIC;
667 if (err) *err = EVAS_LOAD_ERROR_NONE;
670 error = evas_cache_image_load_data(&im->im->cache_entry);
671 switch (im->cs.space)
673 case EVAS_COLORSPACE_ARGB8888:
676 if (im->references > 1)
678 Evas_GL_Image *im_new;
680 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,
681 eng_image_alpha_get(data, image),
682 eng_image_colorspace_get(data, image));
686 if (err) *err = error;
689 evas_gl_common_image_free(im);
693 evas_gl_common_image_dirty(im, 0, 0, 0, 0);
695 *image_data = im->im->image.data;
697 case EVAS_COLORSPACE_YCBCR422P601_PL:
698 case EVAS_COLORSPACE_YCBCR422P709_PL:
699 case EVAS_COLORSPACE_YCBCR422601_PL:
700 case EVAS_COLORSPACE_YCBCR420NV12601_PL:
701 case EVAS_COLORSPACE_YCBCR420TM12601_PL:
702 *image_data = im->cs.data;
708 if (err) *err = error;
713 eng_image_data_put(void *data, void *image, DATA32 *image_data)
716 Evas_GL_Image *im, *im2;
718 re = (Render_Engine *)data;
719 if (!image) return NULL;
721 if (im->native.data) return image;
722 switch (im->cs.space)
724 case EVAS_COLORSPACE_ARGB8888:
725 if (image_data != im->im->image.data)
729 w = im->im->cache_entry.w;
730 h = im->im->cache_entry.h;
731 im2 = eng_image_new_from_data(data, w, h, image_data,
732 eng_image_alpha_get(data, image),
733 eng_image_colorspace_get(data, image));
735 evas_gl_common_image_free(im);
739 case EVAS_COLORSPACE_YCBCR422P601_PL:
740 case EVAS_COLORSPACE_YCBCR422P709_PL:
741 case EVAS_COLORSPACE_YCBCR422601_PL:
742 case EVAS_COLORSPACE_YCBCR420NV12601_PL:
743 case EVAS_COLORSPACE_YCBCR420TM12601_PL:
744 if (image_data != im->cs.data)
748 if (!im->cs.no_free) free(im->cs.data);
750 im->cs.data = image_data;
757 /* hmmm - but if we wrote... why bother? */
758 evas_gl_common_image_dirty(im, 0, 0, 0, 0);
763 eng_image_data_preload_request(void *data __UNUSED__, void *image, const void *target)
765 Evas_GL_Image *gim = image;
769 if (gim->native.data) return;
770 im = (RGBA_Image *)gim->im;
772 evas_cache_image_preload_data(&im->cache_entry, target);
776 eng_image_data_preload_cancel(void *data __UNUSED__, void *image, const void *target)
778 Evas_GL_Image *gim = image;
782 if (gim->native.data) return;
783 im = (RGBA_Image *)gim->im;
785 evas_cache_image_preload_cancel(&im->cache_entry, target);
789 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)
793 re = (Render_Engine *)data;
795 evas_gl_common_context_target_surface_set(re->gl_context, surface);
796 re->gl_context->dc = context;
797 evas_gl_common_image_draw(re->gl_context, image,
798 src_x, src_y, src_w, src_h,
799 dst_x, dst_y, dst_w, dst_h,
804 eng_image_scale_hint_set(void *data __UNUSED__, void *image, int hint)
809 eng_image_map_draw(void *data __UNUSED__, void *context, void *surface, void *image, int npoints, RGBA_Map_Point *p, int smooth, int level)
813 re = (Render_Engine *)data;
814 evas_gl_common_context_target_surface_set(re->gl_context, surface);
815 re->gl_context->dc = context;
816 evas_gl_common_image_map_draw(re->gl_context, image, npoints, p, smooth, level);
820 eng_image_map_surface_new(void *data __UNUSED__, int w, int h, int alpha)
824 re = (Render_Engine *)data;
825 return evas_gl_common_image_surface_new(re->gl_context, w, h, alpha);
829 eng_image_map_surface_free(void *data __UNUSED__, void *surface)
831 evas_gl_common_image_free(surface);
835 eng_image_scale_hint_get(void *data __UNUSED__, void *image)
837 return EVAS_IMAGE_SCALE_HINT_NONE;
841 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)
845 re = (Render_Engine *)data;
846 evas_gl_common_context_target_surface_set(re->gl_context, surface);
847 re->gl_context->dc = context;
849 // FIXME: put im into context so we can free it
850 static RGBA_Image *im = NULL;
853 im = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get());
854 im->cache_entry.w = re->w;
855 im->cache_entry.h = re->h;
856 evas_common_draw_context_font_ext_set(context,
858 evas_gl_font_texture_new,
859 evas_gl_font_texture_free,
860 evas_gl_font_texture_draw);
861 evas_common_font_draw(im, context, x, y, intl_props);
862 evas_common_draw_context_font_ext_set(context,
871 eng_canvas_alpha_get(void *data __UNUSED__, void *info __UNUSED__)
873 // FIXME: support ARGB gl targets!!!
878 eng_image_load_error_get(void *data __UNUSED__, void *image)
882 if (!image) return EVAS_LOAD_ERROR_NONE;
884 return im->im->cache_entry.load_error;
889 module_open(Evas_Module *em)
892 if (!evas_gl_common_module_open()) return 0;
893 /* get whatever engine module we inherit from */
894 if (!_evas_module_engine_inherit(&pfunc, "software_generic")) return 0;
895 if (_evas_engine_GL_SDL_log_dom < 0)
896 _evas_engine_GL_SDL_log_dom = eina_log_domain_register
897 ("evas-gl_sdl", EVAS_DEFAULT_LOG_COLOR);
898 if (_evas_engine_GL_SDL_log_dom < 0)
900 EINA_LOG_ERR("Can not create a module log domain.");
903 /* store it for later use */
905 /* now to override methods */
906 #define ORD(f) EVAS_API_OVERRIDE(f, &func, eng_)
910 ORD(canvas_alpha_get);
913 ORD(output_tile_size_set);
914 ORD(output_redraws_rect_add);
915 ORD(output_redraws_rect_del);
916 ORD(output_redraws_clear);
917 ORD(output_redraws_next_update_get);
918 ORD(output_redraws_next_update_push);
919 ORD(context_cutout_add);
920 ORD(context_cutout_clear);
922 ORD(output_idle_flush);
926 ORD(polygon_point_add);
927 ORD(polygon_points_clear);
931 ORD(image_new_from_data);
932 ORD(image_new_from_copied_data);
936 ORD(image_dirty_region);
939 ORD(image_data_preload_request);
940 ORD(image_data_preload_cancel);
941 ORD(image_alpha_set);
942 ORD(image_alpha_get);
943 ORD(image_border_set);
944 ORD(image_border_get);
946 ORD(image_comment_get);
947 ORD(image_format_get);
948 ORD(image_colorspace_set);
949 ORD(image_colorspace_get);
950 ORD(image_native_set);
951 ORD(image_native_get);
952 #if 0 // filtering disabled
953 // ORD(image_draw_filtered);
954 // ORD(image_filtered_get);
955 // ORD(image_filtered_save);
956 // ORD(image_filtered_free);
960 ORD(image_scale_hint_set);
961 ORD(image_scale_hint_get);
964 ORD(image_map_surface_new);
965 ORD(image_map_surface_free);
967 // ORD(image_content_hint_set);
968 // ORD(image_content_hint_get);
970 // ORD(image_cache_flush);
971 // ORD(image_cache_set);
972 // ORD(image_cache_get);
974 // ORD(gl_surface_create);
975 // ORD(gl_surface_destroy);
976 // ORD(gl_context_create);
977 // ORD(gl_context_destroy);
978 // ORD(gl_make_current);
979 // ORD(gl_proc_address_get);
980 // ORD(gl_native_surface_get);
984 ORD(image_load_error_get);
986 /* now advertise out own api */
987 em->functions = (void *)(&func);
992 module_close(Evas_Module *em)
994 eina_log_domain_unregister(_evas_engine_GL_SDL_log_dom);
995 evas_gl_common_module_close();
998 static Evas_Module_Api evas_modapi =
1000 EVAS_MODULE_API_VERSION,
1009 EVAS_MODULE_DEFINE(EVAS_MODULE_TYPE_ENGINE, engine, gl_sdl);
1011 #ifndef EVAS_STATIC_BUILD_GL_SDL
1012 EVAS_EINA_MODULE_DEFINE(engine, gl_sdl);
1016 _sdl_output_setup (int w, int h, int fullscreen, int noframe)
1018 Render_Engine *re = calloc(1, sizeof(Render_Engine));
1019 SDL_Surface *surface;
1020 int context_attrs[3];
1021 int config_attrs[20];
1022 int major_version, minor_version;
1025 /* if we haven't initialized - init (automatic abort if already done) */
1026 evas_common_cpu_init();
1027 evas_common_blend_init();
1028 evas_common_image_init();
1029 evas_common_convert_init();
1030 evas_common_scale_init();
1031 evas_common_rectangle_init();
1032 evas_common_polygon_init();
1033 evas_common_line_init();
1034 evas_common_font_init();
1035 evas_common_draw_init();
1036 evas_common_tilebuf_init();
1038 if (w <= 0) w = 640;
1039 if (h <= 0) h = 480;
1041 /* GL Initialization */
1042 #ifdef HAVE_SDL_GL_CONTEXT_VERSION
1043 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
1044 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
1046 SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
1047 SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
1048 SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
1049 SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
1050 SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
1051 SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 0);
1053 surface = SDL_SetVideoMode(w, h, 32, EVAS_SDL_GL_FLAG
1054 | (fullscreen ? SDL_FULLSCREEN : 0)
1055 | (noframe ? SDL_NOFRAME : 0));
1059 CRIT("SDL_SetVideoMode [ %i x %i x 32 ] failed. %s", w, h, SDL_GetError());
1064 INF("Screen Depth: %d, Vendor: '%s', Renderer: '%s', Version: '%s'", SDL_GetVideoSurface()->format->BitsPerPixel, glGetString(GL_VENDOR), glGetString(GL_RENDERER), glGetString(GL_VERSION));
1066 re->gl_context = evas_gl_common_context_new();
1067 if (!re->gl_context)
1072 evas_gl_common_context_use(re->gl_context);
1073 evas_gl_common_context_resize(re->gl_context, w, h, re->gl_context->rot);
1075 /* End GL Initialization */