Reputation: 763
I recently managed to get pysdl2 (0.9.3) working on a Windows 8.1 (64-bit) machine (along with the extension modules gfx, mixer, ttf and image). Everything worked fine, including all demos in pysdl2's example folder.
However, when I try to run the same code with the same SDL2 DLL versions on Windows 7 (64-bit), I get the error message:
sdl2.ext.common.SDLrror: 'directx not available'
After calling
sdl2.ext.init()
I tried installing the Directx End User Runtimes (June 2010) and even the complete SDK, but to no avail. I also tried changing the SDL_VIDEODRIVER environment variable to something else than directx, but this does not work either (apparently 'windib' is not available as an option anymore in SDL2).
I know SDL2 is probably looking for Directx 9, which has been completely replaced by Directx 11 nowadays, but after installing the end user runtimes, my system should have Directx 9 at its disposal again. In addition, if this was the cause of the problem, then it also shouldn't have worked on Windows 8.1, since this OS is even newer and is even less likely to carry DX9?
EDIT: On a sidenote, pygame (which uses the older SDL 1.2 libraries) is able to find directx as
pygame.display.get_driver()
outputs:
'directx'
so there must be something wrong with the internal configuration of the SDL2 libraries.
Upvotes: 0
Views: 1088
Reputation: 306
I had the same error directx not available
on Windows XP and worked around it by setting the environment variable SDL_VIDEODRIVER
to windows
using
set SDL_VIDEODRIVER=windows
on the command prompt before starting my Python module. You could also do this directly from Python with
os.environ['SDL_VIDEODRIVER'] = 'windows'
Note that windows
is the only supported driver for Windows in SDL2. directx
and windib
are only valid for SDL1.2.
I ran into this problem because I was importing both Pygame and PySDL2. It turns out that the Pygame module (which uses SDL1.2) changes SDL_VIDEODRIVER
to directx
when it is imported.
Upvotes: 1