The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
What's best way to prefer opengl over directx on windows?
wanton


Joined: 17 Nov 2014
Posts: 1
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.
Re: What's best way to prefer opengl over directx on windows
DLudwig


Joined: 09 Feb 2012
Posts: 179
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.