sdlGlSetAttribute function
Set an OpenGL window attribute before window creation.
This function sets the OpenGL attribute attr
to value
. The requested
attributes should be set before creating an OpenGL window. You should use
SDL_GL_GetAttribute() to check the values after creating the OpenGL
context, since the values obtained can differ from the requested ones.
\param attr an SDL_GLAttr enum value specifying the OpenGL attribute to set. \param value the desired value for the attribute. \returns true on success or false on failure; call SDL_GetError() for more information.
\threadsafety This function should only be called on the main thread.
\since This function is available since SDL 3.1.3.
\sa SDL_GL_GetAttribute \sa SDL_GL_ResetAttributes
extern SDL_DECLSPEC bool SDLCALL SDL_GL_SetAttribute(SDL_GLAttr attr, int value)
Implementation
bool sdlGlSetAttribute(int attr, int value) {
final sdlGlSetAttributeLookupFunction = libSdl3.lookupFunction<
Uint8 Function(Int32 attr, Int32 value),
int Function(int attr, int value)>('SDL_GL_SetAttribute');
return sdlGlSetAttributeLookupFunction(attr, value) == 1;
}