Direct3D with SDL

Hi,

I have a small problem: we want to create an engine that supports a DirectX and and OpenGL
Renderer. Additionally we want this engine to be cross platform. For this we want to use SDL. My
problem now is to create a Window for DirectX. My first try was to create the window via
SDL_Surface and get the window context with GetActiveWindow(). This didn’t work, I don’t know
why. And I can’t program in DirectX, so I thought, I ask here, if anybody has done this before
or if there is a chance to get this working. If not, it’s not really a problem, I only need to
rewrite the window init functions for using the directx Renderer, but I’m really lazy :wink:

Best regards, Enrico

Enrico Zschemisch wrote:

I have a small problem: we want to create an engine that supports a
DirectX and and OpenGL Renderer. Additionally we want this engine to be
cross platform. For this we want to use SDL. My problem now is to create a
Window for DirectX. My first try was to create the window via SDL_Surface
and get the window context with GetActiveWindow(). This didn’t work, I
don’t know why. And I can’t program in DirectX, so I thought, I ask here,
if anybody has done this before or if there is a chance to get this
working. If not, it’s not really a problem, I only need to rewrite the
window init functions for using the directx Renderer, but I’m really lazy
:wink:

If you mean Direct3D with SDL, you can start SDL with GDI driver:
// before SDL_Init();
putenv(“SDL_VIDEODRIVER=windib”);

and you will use the created window handle to initialize D3D:
SDL_SysWMinfo info;
SDL_GetWMInfo(&info);
hWindow = info.window;
// your D3D init…

If you mean SDL and opengl, then refer to the SDL documentation, SDL support
opengl natively:
http://sdldoc.csn.ul.ie/guidevideoopengl.php--
Gautier Portet
www.tlk.fr