[SDL] SDL Performance once again

Peter Mulholland darkmatter at freeuk.com
Fri Sep 8 08:26:42 PDT 2006


Hello Maxim,

Friday, September 8, 2006, 3:18:18 PM, you wrote:

> Sorry for stupid question, but when you say "DirectX/OpenGL" -- does it mean
> that I have to use these libraries' native routines?

For OpenGL, yes. The most SDL will do is take care of the platform
specific parts of initialising GL. It doesn't do anything else, and
the 2D blit stuff does not work when you are using GL.

> I mean, can I invoke, say, SDL_BlitSurface() and somehow enable it to use
> OpenGL (or DirectX) mode? It doesn't work for OpenGL surfaces, if I remember
> correctly... 

Kind of. SDL has various video backends, sometimes more than one on
different platforms. For Windows, there are two - DirectX and GDI.

As of recent SDL versions, the default backend is GDI for reasons of
wider compatibility. However, the DirectX backend will give better
performance. To enable the DirectX backend in your program, add the
following before you call SDL_Init()

SDL_putenv("SDL_VIDEODRIVER=directx");

This should increase performance somewhat. The catch is your program
will require DirectX 7 or better (ie, no Windows 95 or NT). It is
unconfirmed as to whether the older DirectX API's will be in Vista,
but I would imagine Microsoft aren't dumb enough to remove them.

-- 
Best regards,
 Peter                            mailto:darkmatter at freeuk.com





More information about the SDL mailing list