[cogl/wip/rig: 5/33] sdl2: fix GL driver selection
- From: Robert Bragg <rbragg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cogl/wip/rig: 5/33] sdl2: fix GL driver selection
- Date: Mon, 23 Feb 2015 21:34:43 +0000 (UTC)
commit b69470af6883b7a5fc5550ac741bfcca26bac220
Author: Robert Bragg <robert bragg intel com>
Date: Thu Mar 13 16:25:48 2014 +0000
sdl2: fix GL driver selection
SDL2 supports selecting between full OpenGL or OpenGL ES 1/2 but our
selection code was written before SDL 2.0 was officially released and
since then a new SDL_GL_CONTEXT_PROFILE_MASK attribute was added and
we have to explicitly set the SDL_GL_CONTEXT_MINOR_VERSION attribute.
cogl/winsys/cogl-winsys-sdl2.c | 20 ++++++++++++++++----
1 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/cogl/winsys/cogl-winsys-sdl2.c b/cogl/winsys/cogl-winsys-sdl2.c
index 5ffd093..c7e0289 100644
--- a/cogl/winsys/cogl-winsys-sdl2.c
+++ b/cogl/winsys/cogl-winsys-sdl2.c
@@ -167,12 +167,23 @@ _cogl_winsys_display_setup (CoglDisplay *display,
set_gl_attribs_from_framebuffer_config (&display->onscreen_template->config);
if (display->renderer->driver == COGL_DRIVER_GLES1)
- SDL_GL_SetAttribute (SDL_GL_CONTEXT_MAJOR_VERSION, 1);
+ {
+ SDL_GL_SetAttribute (SDL_GL_CONTEXT_PROFILE_MASK,
+ SDL_GL_CONTEXT_PROFILE_ES);
+ SDL_GL_SetAttribute (SDL_GL_CONTEXT_MAJOR_VERSION, 1);
+ SDL_GL_SetAttribute (SDL_GL_CONTEXT_MINOR_VERSION, 1);
+ }
else if (display->renderer->driver == COGL_DRIVER_GLES2)
- SDL_GL_SetAttribute (SDL_GL_CONTEXT_MAJOR_VERSION, 2);
+ {
+ SDL_GL_SetAttribute (SDL_GL_CONTEXT_PROFILE_MASK,
+ SDL_GL_CONTEXT_PROFILE_ES);
+ SDL_GL_SetAttribute (SDL_GL_CONTEXT_MAJOR_VERSION, 2);
+ SDL_GL_SetAttribute (SDL_GL_CONTEXT_MINOR_VERSION, 0);
+ }
else if (display->renderer->driver == COGL_DRIVER_GL3)
{
SDL_GL_SetAttribute (SDL_GL_CONTEXT_MAJOR_VERSION, 3);
+ SDL_GL_SetAttribute (SDL_GL_CONTEXT_MINOR_VERSION, 1);
SDL_GL_SetAttribute (SDL_GL_CONTEXT_PROFILE_MASK,
SDL_GL_CONTEXT_PROFILE_CORE);
SDL_GL_SetAttribute (SDL_GL_CONTEXT_FLAGS,
@@ -239,12 +250,13 @@ _cogl_winsys_display_setup (CoglDisplay *display,
break;
case COGL_DRIVER_GLES2:
- if (!u_str_has_prefix (gl_version, "OpenGL ES 2"))
+ if (!u_str_has_prefix (gl_version, "OpenGL ES 2") &&
+ !u_str_has_prefix (gl_version, "OpenGL ES 3"))
{
_cogl_set_error (error, COGL_WINSYS_ERROR,
COGL_WINSYS_ERROR_INIT,
"The GLES2 driver was requested but SDL is "
- "not using GLES2");
+ "not using GLES2 or GLES3");
goto error;
}
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]