mirror of
https://github.com/encounter/SDL.git
synced 2025-12-09 13:37:56 +00:00
SDL_GL_GetAttribute: If a GL context isn't active, only return failure when the specified attribute needs an active GL context to be queried.
This commit is contained in:
@@ -2913,18 +2913,8 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
|
||||
void (APIENTRY *glGetFramebufferAttachmentParameterivFunc) (GLenum target, GLenum attachment, GLenum pname, GLint* params);
|
||||
GLenum attachment = GL_BACK_LEFT;
|
||||
GLenum attachmentattrib = 0;
|
||||
|
||||
glGetStringFunc = SDL_GL_GetProcAddress("glGetString");
|
||||
if (!glGetStringFunc) {
|
||||
return SDL_SetError("Failed getting OpenGL glGetString entry point");
|
||||
}
|
||||
#endif
|
||||
|
||||
glGetErrorFunc = SDL_GL_GetProcAddress("glGetError");
|
||||
if (!glGetErrorFunc) {
|
||||
return SDL_SetError("Failed getting OpenGL glGetError entry point");
|
||||
}
|
||||
|
||||
/* Clear value in any case */
|
||||
*value = 0;
|
||||
|
||||
@@ -3095,6 +3085,11 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
|
||||
}
|
||||
|
||||
#if SDL_VIDEO_OPENGL
|
||||
glGetStringFunc = SDL_GL_GetProcAddress("glGetString");
|
||||
if (!glGetStringFunc) {
|
||||
return SDL_SetError("Failed getting OpenGL glGetString entry point");
|
||||
}
|
||||
|
||||
if (attachmentattrib && isAtLeastGL3((const char *) glGetStringFunc(GL_VERSION))) {
|
||||
glGetFramebufferAttachmentParameterivFunc = SDL_GL_GetProcAddress("glGetFramebufferAttachmentParameteriv");
|
||||
|
||||
@@ -3115,6 +3110,11 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
|
||||
}
|
||||
}
|
||||
|
||||
glGetErrorFunc = SDL_GL_GetProcAddress("glGetError");
|
||||
if (!glGetErrorFunc) {
|
||||
return SDL_SetError("Failed getting OpenGL glGetError entry point");
|
||||
}
|
||||
|
||||
error = glGetErrorFunc();
|
||||
if (error != GL_NO_ERROR) {
|
||||
if (error == GL_INVALID_ENUM) {
|
||||
|
||||
Reference in New Issue
Block a user