From 795d86b6a547702e7b33caef033a0f0da6fe38a6 Mon Sep 17 00:00:00 2001 From: xcomputerman Date: Sat, 30 Jan 2010 08:11:51 +0000 Subject: [PATCH] Fix gl_sdl for WebOS -- need to check SDL_RESIZABLE because calling SetVideoMode() kills the GL context git-svn-id: http://svn.enlightenment.org/svn/e/trunk/evas@45730 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/modules/engines/gl_common/evas_gl_context.c | 6 ++++- src/modules/engines/gl_sdl/evas_engine.c | 29 +++++++++++++++++-------- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/src/modules/engines/gl_common/evas_gl_context.c b/src/modules/engines/gl_common/evas_gl_context.c index f776a92..fff65f9 100644 --- a/src/modules/engines/gl_common/evas_gl_context.c +++ b/src/modules/engines/gl_common/evas_gl_context.c @@ -19,7 +19,11 @@ gl_symbols(void) if (sym_done) return; sym_done = 1; -#define FINDSYM(dst, sym) if (!dst) dst = dlsym(RTLD_DEFAULT, sym) +#ifdef _EVAS_ENGINE_SDL_H +# define FINDSYM(dst, sym) if (!dst) dst = SDL_GL_GetProcAddress(sym) +#else +# define FINDSYM(dst, sym) if (!dst) dst = dlsym(RTLD_DEFAULT, sym) +#endif #define FALLBAK(dst) if (!dst) dst = (void *)sym_missing; FINDSYM(glsym_glGenFramebuffers, "glGenFramebuffers"); diff --git a/src/modules/engines/gl_sdl/evas_engine.c b/src/modules/engines/gl_sdl/evas_engine.c index b4e0459..e94e471 100644 --- a/src/modules/engines/gl_sdl/evas_engine.c +++ b/src/modules/engines/gl_sdl/evas_engine.c @@ -84,13 +84,17 @@ eng_output_resize(void *data, int w, int h) re->w = w; re->h = h; - surface = SDL_SetVideoMode(w, h, 32, EVAS_SDL_GL_FLAG - | (re->info->flags.fullscreen ? SDL_FULLSCREEN : 0) - | (re->info->flags.noframe ? SDL_NOFRAME : 0)); - if (!surface) + if(SDL_GetVideoSurface()->flags & SDL_RESIZABLE) { - ERR("Unable to change the resolution to : %ix%i", w, h); - exit(-1); + surface = SDL_SetVideoMode(w, h, 32, EVAS_SDL_GL_FLAG + | (re->info->flags.fullscreen ? SDL_FULLSCREEN : 0) + | (re->info->flags.noframe ? SDL_NOFRAME : 0)); + if (!surface) + { + ERR("Unable to change the resolution to : %ix%i", w, h); + SDL_Quit(); + exit(-1); + } } evas_gl_common_context_resize(re->gl_context, w, h); @@ -1366,20 +1370,27 @@ _sdl_output_setup (int w, int h, int fullscreen, int noframe) SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8); - SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); + SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 0); surface = SDL_SetVideoMode(w, h, 32, EVAS_SDL_GL_FLAG - | (fullscreen ? SDL_FULLSCREEN : 0) - | (noframe ? SDL_NOFRAME : 0)); + | (fullscreen ? SDL_FULLSCREEN : 0) + | (noframe ? SDL_NOFRAME : 0)); if (!surface) { CRIT("SDL_SetVideoMode [ %i x %i x 32 ] failed.", w, h); + CRIT("SDL: %s\n", SDL_GetError()); + SDL_Quit(); exit(-1); } + printf("Screen Depth : %d\n", SDL_GetVideoSurface()->format->BitsPerPixel); + printf("Vendor : %s\n", glGetString(GL_VENDOR)); + printf("Renderer : %s\n", glGetString(GL_RENDERER)); + printf("Version : %s\n", glGetString(GL_VERSION)); + re->gl_context = evas_gl_common_context_new(); if (!re->gl_context) { -- 2.7.4