Enabled OpenGL ES 3 support for Windows/Linux/Android when SDL 2.0.4+ is used, since that SDL version fixed its EGL code for GLES 3+.

This commit is contained in:
Alex Szpakowski
2015-05-11 21:14:10 -03:00
parent 811b2db466
commit 3704595189
3 changed files with 8 additions and 14 deletions
+1 -1
View File
@@ -61,7 +61,7 @@ int w_newFont(lua_State *L);
int w_newImageFont(lua_State *L);
int w_newSpriteBatch(lua_State *L);
int w_newParticleSystem(lua_State *L);
int w_newCanvas(lua_State *L); // comments in function
int w_newCanvas(lua_State *L);
int w_newShader(lua_State *L);
int w_newMesh(lua_State *L);
int w_newText(lua_State *L);
+7 -5
View File
@@ -184,17 +184,19 @@ bool Window::createWindowAndContext(int x, int y, int w, int h, Uint32 windowfla
bool debug = (debughint != nullptr && debughint[0] != '0');
// Different context attribute profiles to try.
// FIXME: OpenGL ES 3 is disabled on non-iOS because SDL's EGL code doesn't
// properly handle OpenGL ES 3 context creation requests (for now.)
// https://bugzilla.libsdl.org/show_bug.cgi?id=2865
std::vector<ContextAttribs> attribslist = {
{2, 1, false, debug}, // OpenGL 2.1.
#ifdef LOVE_IOS
{3, 0, true, debug}, // OpenGL ES 3.
#endif
{2, 0, true, debug}, // OpenGL ES 2.
};
SDL_version sdlversion = {};
SDL_GetVersion(&sdlversion);
// OpenGL ES 3+ contexts are only properly supported in SDL 2.0.4+.
if (sdlversion.major == 2 && sdlversion.minor == 0 && sdlversion.patch <= 3)
attribslist.erase(attribslist.begin() + 1);
// Move OpenGL ES to the front of the list if we should prefer GLES.
if (preferGLES)
std::rotate(attribslist.begin(), attribslist.begin() + 1, attribslist.end());