GraphicsWindowSDL2: support setting up GLESv2 context for android

0.6.3
Ilya Zhuravlev 7 years ago
parent 455f718394
commit 359910762d

@ -92,9 +92,18 @@ void GraphicsWindowSDL2::init()
SDL_GLContext oldCtx = SDL_GL_GetCurrentContext(); SDL_GLContext oldCtx = SDL_GL_GetCurrentContext();
#if defined(OPENGL_ES) || defined(ANDROID) #if defined(OPENGL_ES) || defined(ANDROID)
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES); int major = 1;
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 1); int minor = 1;
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 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 #endif
mContext = SDL_GL_CreateContext(mWindow); mContext = SDL_GL_CreateContext(mWindow);

Loading…
Cancel
Save