SDL_GL_ExtensionSupported(3)

✨ SDL_GL_ExtensionSupported ✨

okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual πŸ’– this one is SDL_GL_ExtensionSupported and it does exactly one (1) job: telling you whether an OpenGL extension is supported for the current context. that's it. that's the whole vibe check. πŸ¦‹


🌸 NAME 🌸

SDL_GL_ExtensionSupported β€” check if an OpenGL extension is supported for the current context.


πŸŽ€ SYNOPSIS πŸŽ€

#include <SDL3/SDL_video.h>

bool SDL_GL_ExtensionSupported(const char *extension);

πŸ’… DESCRIPTION πŸ’…

so here's the tea, and it's important tea: this function operates on the current GL context. not some context you're dreaming about, not a context you'll make later β€” the one that's current right now. you must have created a context, and it must be current, before you even think about calling this. periodt.

and like, do not assume that all the contexts you create will have the same set of extensions available. they might not! also do not assume that recreating an existing context will offer the same extensions again. contexts are giving main character energy and they will simply do what they want. πŸ™ˆ

now, about performance β€” while it's probably not a massive overhead, this function is not an O(1) operation. so the move is: check the extensions you care about right after creating the GL context, and then save that information somewhere instead of calling this function every single time you need to know. she's not a free little lookup, she's a whole function call. 😭

bestie note: check once, write it down, move on. your frame time will thank you. 🫢

⭐ FUNCTION PARAMETERS ⭐

  • extension β€” the name of the extension to check. πŸ‘‘

🌈 RETURN VALUE 🌈

Returns true if the extension is supported, false otherwise. no in-between, no situationship. πŸ’€


πŸ”₯ THREAD SAFETY πŸ”₯

This function should only be called on the main thread. don't be sending her off to a worker thread, she will not slay there. πŸ’…


πŸ‘‘ AVAILABILITY πŸ‘‘

This function is available since SDL 3.2.0. iconic behavior honestly. ✨


mwah πŸ’– that's the whole page, you ate it, go forth and query your extensions responsibly. this one came to you from Simple Directmedia Layer, running the SDL 3.4.18 era of the manual β€” and yes, SDL_GL_ExtensionSupported(3) is the name, say it with your chest. πŸŽ€πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from