windowless directx render
Hi does anyone know how to set up directx without a window. What I'm trying to do is use some of the features of directx and render to a file. However I don't want a window to show up, and I'd prefer not to use any hardware. Ideally I would do this all in software.
You can set up the renderer to render to a texture, and then export that texture to your file.
------------Anything prior to 9am should be illegal.
Create a REF device and attach it to a window that you never show on screen.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
By "hardware" do you mean graphics hardware? There is no software implementation of D3D...well there is but you can only use it with the debug binaries that come with the SDK (and you can't redistribute those). If you're looking for something that's purely software you might want to use a software implementation of OpenGL.
As for the window thing...you can't create a D3D device without specifying a valid window (at least in D3D9, I'm not sure about D3D10). However there's no reason you couldn't just create a window and never make it visible, the user would never even know it was there. Then you could just render to a texture or surface, save it to a file, and then quit before ever calling Present (which displays the backbuffer on the window's client area).
As for the window thing...you can't create a D3D device without specifying a valid window (at least in D3D9, I'm not sure about D3D10). However there's no reason you couldn't just create a window and never make it visible, the user would never even know it was there. Then you could just render to a texture or surface, save it to a file, and then quit before ever calling Present (which displays the backbuffer on the window's client area).
Regarding rendering without a window:
D3D10: no problem, just use D3D10CreateDevice. It doesn't require a window.
D3D9: must have a window. Here's the code I use:
I then use this window, which is invisible.
Regarding rendering without hardware:
Direct3D doesn't support this. REF is included only in the SDK and doesn't exist on a standard DX installation. You can try using SwiftShader.
D3D10: no problem, just use D3D10CreateDevice. It doesn't require a window.
D3D9: must have a window. Here's the code I use:
// Register the window class WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, DefWindowProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, cWindowClassName, NULL }; RegisterClassEx(&wc); mWindowClass = wc.hInstance; mWindow = CreateWindow( cWindowClassName, "Invisible", WS_OVERLAPPEDWINDOW, 0, 0, 1, 1, GetDesktopWindow(), 0, mWindowClass, NULL);
I then use this window, which is invisible.
Regarding rendering without hardware:
Direct3D doesn't support this. REF is included only in the SDK and doesn't exist on a standard DX installation. You can try using SwiftShader.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement