I tried to port some OpenGL software to use the wrap system and encountered some trouble with the SDL2 wrap. It seems like not all OpenGL functionality gets enabled.
For example, SDL_GL_GetAttribute() would return SDL_Unsupported().
Glancing at the meson.build I discovered that cdata.set('SDL_VIDEO_RENDER_OGL', 1) and cdata.set('SDL_VIDEO_OPENGL_GLX', 1) are being set. But it seems it also needs some more defines to properly support SDL2 OpenGL functions.
I'm not sure what exactly is required, or how and when things to enable - but as a quick shot I tried adding cdata.set('SDL_VIDEO_OPENGL', 1) (what about OpenGL ES, etc?) and at least for me it got me a bit further (no thorough testing done though).
|Executing subproject sdl2 method meson
|
|Project name: sdl2
|Project version: 2.0.12
|C compiler for the host machine: cc (gcc 10.2.1 "cc (Debian 10.2.1-6) 10.2.1 20210110")
|C linker for the host machine: cc ld.bfd 2.35.1
|Library m found: YES
|Library dl found: YES
|Library pthread found: YES
|Has header "alloca.h" : YES (cached)
|Has header "sys/types.h" : YES (cached)
|Has header "stdio.h" : YES (cached)
|Has header "stdlib.h" : YES (cached)
|Has header "stdarg.h" : YES (cached)
|Has header "malloc.h" : YES (cached)
|Has header "memory.h" : YES (cached)
|Has header "string.h" : YES (cached)
|Has header "strings.h" : YES (cached)
|Has header "inttypes.h" : YES (cached)
|Has header "stdint.h" : YES (cached)
|Has header "ctype.h" : YES (cached)
|Has header "math.h" : YES (cached)
|Has header "iconv.h" : YES (cached)
|Has header "signal.h" : YES (cached)
|Has header "altivec.h" : NO (cached)
|Has header "pthread/np.h" : NO (cached)
|Has header "libudev.h" : YES (cached)
|Has header "dbus/dbus.h" : NO (cached)
|Has header "stdarg.h" : YES (cached)
|Has header "stddef.h" : YES (cached)
|Checking for function "malloc" : YES (cached)
|Checking for function "calloc" : YES (cached)
|Checking for function "realloc" : YES (cached)
|Checking for function "free" : YES (cached)
|Checking for function "alloca" : YES (cached)
|Checking for function "setenv" : YES (cached)
|Checking for function "setenv" : YES (cached)
|Checking for function "putenv" : YES (cached)
|Checking for function "unsetenv" : YES (cached)
|Checking for function "qsort" : YES (cached)
|Checking for function "abs" : YES (cached)
|Checking for function "bcopy" : YES (cached)
|Checking for function "memset" : YES (cached)
|Checking for function "memcpy" : YES (cached)
|Checking for function "memmove" : YES (cached)
|Checking for function "memcmp" : YES (cached)
|Checking for function "strlen" : YES (cached)
|Checking for function "strlcpy" : NO (cached)
|Checking for function "strlcat" : NO (cached)
|Checking for function "strdup" : YES (cached)
|Checking for function "_strrev" : NO (cached)
|Checking for function "_strupr" : NO (cached)
|Checking for function "_strlwr" : NO (cached)
|Checking for function "index" : YES (cached)
|Checking for function "rindex" : YES (cached)
|Checking for function "strchr" : YES (cached)
|Checking for function "strrchr" : YES (cached)
|Checking for function "strstr" : YES (cached)
|Checking for function "itoa" : NO (cached)
|Checking for function "_ltoa" : NO (cached)
|Checking for function "_uitoa" : NO (cached)
|Checking for function "_ultoa" : NO (cached)
|Checking for function "strtol" : YES (cached)
|Checking for function "strtoul" : YES (cached)
|Checking for function "_i64toa" : NO (cached)
|Checking for function "_uit64toa" : NO (cached)
|Checking for function "strtoll" : YES (cached)
|Checking for function "strtoull" : YES (cached)
|Checking for function "strtod" : YES (cached)
|Checking for function "atoi" : YES (cached)
|Checking for function "atof" : YES (cached)
|Checking for function "strcmp" : YES (cached)
|Checking for function "strncmp" : YES (cached)
|Checking for function "_stricmp" : NO (cached)
|Checking for function "strcasecmp" : YES (cached)
|Checking for function "_strnicmp" : NO (cached)
|Checking for function "strncasecmp" : YES (cached)
|Checking for function "vsscanf" : YES (cached)
|Checking for function "vsnprintf" : YES (cached)
|Checking for function "atan" : NO (cached)
|Checking for function "atan2" : NO (cached)
|Checking for function "acos" : NO (cached)
|Checking for function "asin" : NO (cached)
|Checking for function "ceil" : NO (cached)
|Checking for function "copysign" : YES (cached)
|Checking for function "cos" : NO (cached)
|Checking for function "cosf" : NO (cached)
|Checking for function "fabs" : NO (cached)
|Checking for function "floor" : NO (cached)
|Checking for function "log" : NO (cached)
|Checking for function "pow" : NO (cached)
|Checking for function "scalbn" : YES (cached)
|Checking for function "sin" : NO (cached)
|Checking for function "sinf" : NO (cached)
|Checking for function "sqrt" : NO (cached)
|Checking for function "fseeko" : YES (cached)
|Checking for function "fseeko64" : NO (cached)
|Checking for function "sigaction" : YES (cached)
|Checking for function "setjmp" : YES (cached)
|Checking for function "nanosleep" : YES (cached)
|Checking for function "sysconf" : YES (cached)
|Checking for function "sysctlbyname" : NO (cached)
|Checking for function "clock_gettime" : YES (cached)
|Checking for function "getpagesize" : YES (cached)
|Checking for function "mprotect" : YES (cached)
|Checking for function "pthread_setname_np" : NO (cached)
|Checking for function "pthread_set_name_np" : NO (cached)
|Checking if "M_PI" compiles: NO (cached)
|Dependency alsa found: YES 1.2.4 (cached)
|Dependency x11 found: YES 1.7.0 (cached)
|Dependency xi found: YES 1.7.10 (cached)
|Dependency xext found: YES 1.3.3 (cached)
|Dependency gl found: YES 1.2 (cached)
|Dependency xrandr found: YES 1.5.1 (cached)
|Dependency xinerama found: YES 1.1.4 (cached)
|Configuring SDL_config.h using configuration
|Build targets in project: 2
|Subproject sdl2 finished.
I tried to port some OpenGL software to use the wrap system and encountered some trouble with the SDL2 wrap. It seems like not all OpenGL functionality gets enabled.
For example,
SDL_GL_GetAttribute()
would returnSDL_Unsupported()
.Glancing at the
meson.build
I discovered thatcdata.set('SDL_VIDEO_RENDER_OGL', 1)
andcdata.set('SDL_VIDEO_OPENGL_GLX', 1)
are being set. But it seems it also needs some more defines to properly support SDL2 OpenGL functions.I'm not sure what exactly is required, or how and when things to enable - but as a quick shot I tried adding
cdata.set('SDL_VIDEO_OPENGL', 1)
(what about OpenGL ES, etc?) and at least for me it got me a bit further (no thorough testing done though).