Skip to content

Commit

Permalink
GraphicsWindowSDL2: support setting up GLESv2 context for android
Browse files Browse the repository at this point in the history
  • Loading branch information
xyzz committed Jan 18, 2018
1 parent 455f718 commit 3599107
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions components/sdlutil/sdlgraphicswindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,18 @@ void GraphicsWindowSDL2::init()
SDL_GLContext oldCtx = SDL_GL_GetCurrentContext();

#if defined(OPENGL_ES) || defined(ANDROID)
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);
int major = 1;
int minor = 1;
char *ver = getenv("OPENMW_GLES_VERSION");

if (ver && strcmp(ver, "2") == 0) {
major = 2;
minor = 0;
}

SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, major);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, minor);
#endif

mContext = SDL_GL_CreateContext(mWindow);
Expand Down

0 comments on commit 3599107

Please sign in to comment.