Jump to content
  • Advertisement
Sign in to follow this  
bigryanjoel

windowless directx render

This topic is 3830 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
Create a REF device and attach it to a window that you never show on screen.

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites
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:


// 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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!