mirror of https://github.com/encounter/SDL.git
Allow GL_ARB_texture_non_power_of_two environment variable to override OpenGL 2.0 check
This commit is contained in:
parent
1b7669374e
commit
b064ad6ac5
|
@ -1726,8 +1726,8 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags)
|
||||||
Uint32 window_flags;
|
Uint32 window_flags;
|
||||||
int profile_mask = 0, major = 0, minor = 0;
|
int profile_mask = 0, major = 0, minor = 0;
|
||||||
SDL_bool changed_window = SDL_FALSE;
|
SDL_bool changed_window = SDL_FALSE;
|
||||||
SDL_bool isGL2 = SDL_FALSE;
|
const char *hint;
|
||||||
const char *verstr = NULL;
|
SDL_bool non_power_of_two_supported = SDL_FALSE;
|
||||||
|
|
||||||
SDL_GL_GetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, &profile_mask);
|
SDL_GL_GetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, &profile_mask);
|
||||||
SDL_GL_GetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, &major);
|
SDL_GL_GetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, &major);
|
||||||
|
@ -1847,22 +1847,29 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags)
|
||||||
data->glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
|
data->glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
|
||||||
}
|
}
|
||||||
|
|
||||||
verstr = (const char *) data->glGetString(GL_VERSION);
|
hint = SDL_getenv("GL_ARB_texture_non_power_of_two");
|
||||||
if (verstr) {
|
if (!hint || *hint != '0') {
|
||||||
char verbuf[16];
|
SDL_bool isGL2 = SDL_FALSE;
|
||||||
char *ptr;
|
const char *verstr = (const char *)data->glGetString(GL_VERSION);
|
||||||
SDL_strlcpy(verbuf, verstr, sizeof (verbuf));
|
if (verstr) {
|
||||||
ptr = SDL_strchr(verbuf, '.');
|
char verbuf[16];
|
||||||
if (ptr) {
|
char *ptr;
|
||||||
*ptr = '\0';
|
SDL_strlcpy(verbuf, verstr, sizeof (verbuf));
|
||||||
if (SDL_atoi(verbuf) >= 2) {
|
ptr = SDL_strchr(verbuf, '.');
|
||||||
isGL2 = SDL_TRUE;
|
if (ptr) {
|
||||||
|
*ptr = '\0';
|
||||||
|
if (SDL_atoi(verbuf) >= 2) {
|
||||||
|
isGL2 = SDL_TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (isGL2 || SDL_GL_ExtensionSupported("GL_ARB_texture_non_power_of_two")) {
|
||||||
|
non_power_of_two_supported = SDL_TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data->textype = GL_TEXTURE_2D;
|
data->textype = GL_TEXTURE_2D;
|
||||||
if (isGL2 || SDL_GL_ExtensionSupported("GL_ARB_texture_non_power_of_two")) {
|
if (non_power_of_two_supported) {
|
||||||
data->GL_ARB_texture_non_power_of_two_supported = SDL_TRUE;
|
data->GL_ARB_texture_non_power_of_two_supported = SDL_TRUE;
|
||||||
data->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &value);
|
data->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &value);
|
||||||
renderer->info.max_texture_width = value;
|
renderer->info.max_texture_width = value;
|
||||||
|
|
Loading…
Reference in New Issue