What's best way to prefer opengl over directx on windows?

What’s the best way to prefer opengl over directx in windows?
I’m currently using SDL_GetRenderDriverInfo to find driver index with name “opengl” and using that index with SDL_CreateRenderer. If that fails I use default driver index -1.

wanton wrote:

What’s the best way to prefer opengl over directx in windows?
I’m currently using SDL_GetRenderDriverInfo to find driver index with name “opengl” and using that index with SDL_CreateRenderer. If that fails I use default driver index -1.

Setting SDL_HINT_RENDER_DRIVER before calling SDL_CreateRenderer will also work. For example:

Code:
SDL_SetHint(SDL_HINT_RENDER_DRIVER, “opengl”);

… then use an index of -1 in the call to SDL_CreateRenderer.

– David L.