Quake 2 XP black screen after loading a level
mbriar opened this issue · 10 comments
Using sdl12-compat version 1.2.60 causes the linux build of Quake 2 XP to only display a black screen after loading a level, it works fine when using real libsdl1.2 on the same system.
With a debug build of Mesa, these errors are generated:
Mesa: User error: GL_INVALID_OPERATION in glDrawBuffer(invalid buffer GL_BACK)
Mesa: User error: GL_INVALID_OPERATION in glUniform(location=23)
Mesa: 9 similar GL_INVALID_OPERATION errors
See this comment in the original Mesa bug report about this for how to build and run Quake 2 XP, thanks!
Could you make sure that SDL_VIDEODRIVER=x11
: it looks like quake2xp uses X11 directly in a bunch of places. This is the default (except on Fedora, I think?), but it's worth double-checking…
Also, have you tried setting SDL12COMPAT_OPENGL_SCALING=0
?
Or (though it's more of a stretch), SDL12COMPAT_FORCE_GL_SWAPBUFFER_CONTEXT=1
.
That being said, it looks like quake2xp is doing a few dubious things, like loading the 'qgl' symbols by directly dlopen()ing libGL.so.1
. I think that might cause issues with the newer libglvnd-based setups…?
Hey, thanks for the quick response.
I ran this on x11, so it couldn't have used the wayland driver. Setting SDL12COMPAT_OPENGL_SCALING=0
does fix the issue though 🎉
Since q2xp is open source, it might be a better idea to just properly port it to SDL2 directly, but i thought it might be still worth reporting to see if it uncovers something to fix in sdl12-compat.
Just for completeness: SDL12COMPAT_FORCE_GL_SWAPBUFFER_CONTEXT=1
does not help.
Yeah: my guess here is that because q2xp uses dlopen
and dlsym
directly to get the OpenGL functions, instead of using SDL_GL_GetProcAddress()
, sdl12-compat is unable to hook them to make the game render to our "fake" backbuffer.
Obviously porting to SDL2 is the ideal solution (and it looked like some attempts had been made at some point, from the code). In the meantime, using SDL_GL_GetProcAddress()
might fix it. Otherwise (and this may make sense anyway), we could add an entry to the quirks table in sdl12-compat to automatically disable OpenGL scaling for q2xp
.
Hey, thanks for the quick response. I ran this on x11, so it couldn't have used the wayland driver. Setting
SDL12COMPAT_OPENGL_SCALING=0
does fix the issue though tada Since q2xp is open source, it might be a better idea to just properly port it to SDL2 directly, but i thought it might be still worth reporting to see if it uncovers something to fix in sdl12-compat.
Just wanted to add that I ran this in Wayland and had the same black-screen issue but SDL12COMPAT_OPENGL_SCALING=0
did fix the issue.
Latest sdl12-compat now has a quirk listed for quake2xp, so it won't need manual intervention to make this work.
If they happen to fix this to use SDL_GL_GetProcAddress instead of dlsym, we can remove the quirk and OpenGL scaling can work.
Oh, awesome! I'll remove the quirk. Thanks!!
Quirk removed. :)
😄 👍