Discussion:
Must DX device be created around a Control?
(too old to reply)
mybang
2005-11-23 09:22:04 UTC
Permalink
Hi, my problem is like this:
I'm writing a piece of code, to be used in a web service (from where the
problem really stalk). I thought it work to create a control (not shown), and
then use it to create a directx Device. I rendered something on the device,
and saved the result as a stream. I tested the code in windows application,
and it worked perfectly. But
it seems this scheme doesn't work as a part of web service program.
Must DX device be created around a control?
Robert Dunlop [MS MVP]
2005-11-24 15:38:06 UTC
Permalink
Post by mybang
I'm writing a piece of code, to be used in a web service (from where the
problem really stalk). I thought it work to create a control (not shown), and
then use it to create a directx Device. I rendered something on the device,
and saved the result as a stream. I tested the code in windows
application,
and it worked perfectly. But
it seems this scheme doesn't work as a part of web service program.
Must DX device be created around a control?
Device creation needs to hook to a valid window to provide access to the
video adapter and hooks into the message loop, and your web service doesn't
have an associated window to poiint the device to. Someone may have an
answer for this one, but myself I think I would take a different approach
here, because having to instantiate a D3D device every time the web service
is called could be quite expensive.

One thing I would consider if I needed to have D3D generate images for a web
service would be to create a separate windows application that handles the
desired rendering, and expose it through .NET Remoting as a TCP channel (or
whatever interprocess communication method you fancy) that the web service
can call to render the graphics and return the image. In this manner a
device could be maintained by a separate application that contains a control
window for the D3D device, and the device would be re-used without having
the latency of creating the device each time. Segregating the graphics
processing into a separate application that handles calls from the web
service would also mean that the graphics processing could be moved onto
another computer if you wanted to move the rendering overhead away from the
web server.
--
Robert Dunlop
The X-Zone
http://www.directxzone.com/
Microsoft DirectX MVP
-------------
The opinions expressed in this message are my own personal views and do not
reflect the official views of the Microsoft Corporation.
The MVP program does not constitute employment or contractual obligation
with Microsoft.
supoch14
2008-08-22 19:20:01 UTC
Permalink
Post by Robert Dunlop [MS MVP]
Post by mybang
I'm writing a piece of code, to be used in a web service (from where the
problem really stalk). I thought it work to create a control (not shown), and
then use it to create a directx Device. I rendered something on the device,
and saved the result as a stream. I tested the code in windows application,
and it worked perfectly. But
it seems this scheme doesn't work as a part of web service program.
Must DX device be created around a control?
Device creation needs to hook to a valid window to provide access to the
video adapter and hooks into the message loop, and your web service doesn't
have an associated window to poiint the device to. Someone may have an
answer for this one, but myself I think I would take a different approach
here, because having to instantiate a D3D device every time the web service
is called could be quite expensive.
One thing I would consider if I needed to have D3D generate images for a web
service would be to create a separate windows application that handles the
desired rendering, and expose it through .NET Remoting as a TCP channel (or
whatever interprocess communication method you fancy) that the web service
can call to render the graphics and return the image. In this manner a
device could be maintained by a separate application that contains a control
window for the D3D device, and the device would be re-used without having
the latency of creating the device each time. Segregating the graphics
processing into a separate application that handles calls from the web
service would also mean that the graphics processing could be moved onto
another computer if you wanted to move the rendering overhead away from the
web server.
--
Robert Dunlop
The X-Zone
http://www.directxzone.com/
Microsoft DirectX MVP
-------------
The opinions expressed in this message are my own personal views and do not
reflect the official views of the Microsoft Corporation.
The MVP program does not constitute employment or contractual obligation
with Microsoft.
supoch14
2008-08-22 19:19:01 UTC
Permalink
Post by mybang
I'm writing a piece of code, to be used in a web service (from where the
problem really stalk). I thought it work to create a control (not shown), and
then use it to create a directx Device. I rendered something on the device,
and saved the result as a stream. I tested the code in windows application,
and it worked perfectly. But
it seems this scheme doesn't work as a part of web service program.
Must DX device be created around a control?
Continue reading on narkive:
Loading...