Good evening.
I'm setting up my game project on a remote computer and am running into a problem with SDL. I'm using SDL 2.0 and I'm trying to figure out why SDL_GetNumVideoDisplays() returns 1 when I have 2 monitors hooked up to my PC. I'm running Ubuntu 14.04 LTS, and both monitors appear to be configured correctly just using the desktop as normal.
Would appreciate tips on where to look to troubleshoot this issue. Thanks.
Update 1 - ./configure
for SDL2-2.0.4 source code:
Was looking for some mention of X11 in the configure script and saw the following:
checking for X11/extensions/Xext.h... yes
-- dynamic libX11 -> libX11.so.6
-- dynamic libX11ext -> libXext.so.6
checking for const parameter to XextAddDisplay... yes
checking for XGenericEvent... yes
checking for XkbKeycodeToKeysym in -lX11... yes
checking for X11/Xcursor/Xcursor.h... no
checking for X11/extensions/Xdbe.h... yes
checking for X11/extensions/Xinerama.h... no
checking for X11/extensions/XInput2.h... no
checking for X11/extensions/scrnsaver.h... no
checking for X11/extensions/shape.h... yes
checking for X11/extensions/xf86vmode.h... yes
and
X11 libraries : xdbe xshape xvidmode
My xrandr --version
is:
xrandr program version 1.4.1
Server reports RandR version 1.4
xrandr --listactivemonitors
doesn't seem to be supported on my install.
Update 2 - Reinstalled OS, completely wiping partition:
Things escalated quickly today when I decided just to take the nuclear option. Fortunately there was nothing on the disk I needed as I had freshly cloned my repo and hadn't made any changes worth committing.
After a day swapping between open and proprietary drivers and tinkering with my xorg.conf, I ended up nuking the disk and installing 16.04 LTS. I installed the SDL2 runtimes from the ubuntu repo, and I installed the SDL2 development source from the tar file on the SDL website. Ran my program again and it worked as expected.
I don't want to call this "solved" as I ended up nuking my OS, but I guess my problem is solved. I just wish I could figure out the information chain on how SDL is informed on how many displays there are.
checking for X11/extensions/Xinerama.h... no
That's probably what torpedoed you. Xinerama is used to query the output count/positions/topology:
The X server's client/server architecture allows the server to expose Xinerama information to the client regardless of whether the Xinerama infrastructure is active. RandR and NVidia's twinview utilize this feature to provide window managers and clients with information about the output layout relative to the framebuffer.
Installing libxinerama-dev
& re-configure
ing probably would have cleared that up.