SDL_EGL_SETATTRIBUTECALLBACKS(3)

✨ SDL_EGL_SetAttributeCallbacks ✨

okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, where today's main character is SDL_EGL_SetAttributeCallbacks(3) πŸ’… she's the one who lets you hand SDL your very own custom EGLAttrib arrays for EGL init. lowkey powerful, ngl.


🌸 NAME 🌸

SDL_EGL_SetAttributeCallbacks β€” sets the callbacks for defining custom EGLAttrib arrays for EGL initialization. it's giving "you're in charge of the attribute list now" πŸ‘‘


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <SDL3/SDL_video.h>

void SDL_EGL_SetAttributeCallbacks(SDL_EGLAttribArrayCallback platformAttribCallback,
                                   SDL_EGLIntArrayCallback surfaceAttribCallback,
                                   SDL_EGLIntArrayCallback contextAttribCallback, void *userdata);

like, copy that character for character, no cap. πŸŽ€


πŸ’– DESCRIPTION πŸ’–

so here's the tea: callbacks that aren't needed can be set to NULL. fr fr, just pass NULL and move on with your life. ✨

NOTE: These callback pointers will be reset after SDL_GL_ResetAttributes. 😭 so don't come crying to me when your cute little callbacks vanish β€” that's just the documented behaviour, bestie.

πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • platformAttribCallback β€” callback for attributes to pass to eglGetPlatformDisplay. May be NULL. optional queen 🫢
  • surfaceAttribCallback β€” callback for attributes to pass to eglCreateSurface. May be NULL. also optional, slay 🌈
  • contextAttribCallback β€” callback for attributes to pass to eglCreateContext. May be NULL. yep, optional too ⭐
  • userdata β€” a pointer that is passed to the callbacks. your lil carry-on bag, hand-delivered to every callback πŸ“

πŸ”₯ THREAD SAFETY πŸ”₯

This function should only be called on the main thread. periodt. don't be chaotic about it. πŸ’€


πŸ‘‘ AVAILABILITY πŸ‘‘

This function is available since SDL 3.2.0. πŸŽ‰ she's been around, she's established, she ate.


and that's the whole vibe check, bestie β€” go forth and customize those EGL attrib arrays responsibly πŸ’œπŸ§š

this lil love letter to your terminal comes straight from Simple Directmedia Layer, SDL 3.4.18, and the page is literally called SDL_EGL_SetAttributeCallbacks(3) β€” mwah, bye bye πŸ’…βœ¨

πŸ“¦ where this page comes from