Sign in to follow this  
MrSparkle27

Windowless DirectX application

Recommended Posts

Hi, I want to write a little Direct3D application that renders to an offscreen surface only, and than saves the render ouput to an image file. For performance and design reasons I'm looking for a way to create a Direct3D device that does not use a backbuffer or a window control. The constructor of the Direct3D.Device will fail if there is no control passed in the "renderWindow" parameter. But is it possible to use the device with a hidden control? Thanks in advance, Christian

Share this post


Link to post
Share on other sites
You can create a scratch device, which is also called a NULLREF device (I think). The thing is, that device isn't capable of doing rendering. It can only be used to load textures/other resources, and lock, pretty much.

If you need actual rendering, you'll need a control to render to.

Hope this helps.

Share this post


Link to post
Share on other sites
It's possible to use the device with a window which isn't shown. When I need offscreen rendering I usually create a small window (say, 16x16 -- IIRC because I once had a failed creation when trying 1x1), don't show it, and create a device for it.

Share this post


Link to post
Share on other sites
Thank you. :)
Now I can render to a offscreen buffer and save it to file.

I now want to provide the option to show a preview of the saved image in a small control.

What is the best way to show the offscreen surface / texture on screen:

1. Resize the BackBuffer to the control's size and draw the texture on a Sprite and call device.Present(previewControl).

2. Do some magic trick to draw the offscreen buffer directly on the control with out using a BackBuffer. Seems that the ID3D10Device::CopySubresourceRegion() method does something similar, but I can't find a Managed DX9 equivalent.

3. Use DirectDraw (but I guess I need to convert the surface data somehow which will reduce the performance).

4. Use GDI (the same applies here, I think)

5. any other idea?



Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this