video: add NOT_AN_OPENGL_WINDOW define (similar to NOT_A_VULKAN_WINDOW)

This commit is contained in:
pionere 2022-11-11 12:09:15 +01:00 committed by Sam Lantinga
parent 36c6ed4b6f
commit b71d927429
1 changed files with 5 additions and 3 deletions

View File

@ -4067,6 +4067,8 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
#endif /* SDL_VIDEO_OPENGL */
}
#define NOT_AN_OPENGL_WINDOW "The specified window isn't an OpenGL window"
SDL_GLContext
SDL_GL_CreateContext(SDL_Window * window)
{
@ -4074,7 +4076,7 @@ SDL_GL_CreateContext(SDL_Window * window)
CHECK_WINDOW_MAGIC(window, NULL);
if (!(window->flags & SDL_WINDOW_OPENGL)) {
SDL_SetError("The specified window isn't an OpenGL window");
SDL_SetError(NOT_AN_OPENGL_WINDOW);
return NULL;
}
@ -4111,7 +4113,7 @@ SDL_GL_MakeCurrent(SDL_Window * window, SDL_GLContext ctx)
CHECK_WINDOW_MAGIC(window, -1);
if (!(window->flags & SDL_WINDOW_OPENGL)) {
return SDL_SetError("The specified window isn't an OpenGL window");
return SDL_SetError(NOT_AN_OPENGL_WINDOW);
}
} else if (!_this->gl_allow_no_surface) {
return SDL_SetError("Use of OpenGL without a window is not supported on this platform");
@ -4192,7 +4194,7 @@ SDL_GL_SwapWindowWithResult(SDL_Window * window)
CHECK_WINDOW_MAGIC(window, -1);
if (!(window->flags & SDL_WINDOW_OPENGL)) {
return SDL_SetError("The specified window isn't an OpenGL window");
return SDL_SetError(NOT_AN_OPENGL_WINDOW);
}
if (SDL_GL_GetCurrentWindow() != window) {