DirectX 9 - 创建设备并渲染到 DLL 内的纹理?
我试图在 DLL 中创建托管 DirectX 9 设备,然后使用该 DLL 将场景渲染到屏幕外表面。我知道如何进行离屏渲染,但我的问题是:
是否可以在 DLL 内创建 directx 设备?
无力的尝试 #1 (InvalidCallException< /code>):
Device device = new Device(0, DeviceType.Hardware, null, CreateFlags.SoftwareVertexProcessing, presentParams);
无力的尝试 #2 (InvalidCallException
):
Device device = new Device(0, DeviceType.Hardware, new IntPtr(0), CreateFlags.SoftwareVertexProcessing, presentParams);
可用的设备构造函数重载是:
public Device(int, DeviceType, Control, CreateFlags, PresentParameters[]);
public Device(int, DeviceType, IntPtr, CreateFlags, PresentParameters[]);
任何帮助都可能让我开心!
I am trying to create a Managed DirectX 9 Device in a DLL and then use that DLL to render scenes to an offscreen surface. I know how to do the offscreen rendering, but my question is:
Is it possible to create a directx device inside a DLL?
Feeble attempt #1 (InvalidCallException
):
Device device = new Device(0, DeviceType.Hardware, null, CreateFlags.SoftwareVertexProcessing, presentParams);
Feeble attempt #2 (InvalidCallException
):
Device device = new Device(0, DeviceType.Hardware, new IntPtr(0), CreateFlags.SoftwareVertexProcessing, presentParams);
The device constructor overloads available are:
public Device(int, DeviceType, Control, CreateFlags, PresentParameters[]);
public Device(int, DeviceType, IntPtr, CreateFlags, PresentParameters[]);
Any help could quite possibly make my day!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
找到了答案。我创建了一个隐藏控件,适当地设置它的宽度和高度,然后将其设置为目标。作品完美。对于那些稍后可能会偶然发现这一点的人来说,这里是代码:
这就是所需要的一切,假设就像我在渲染纹理之前所说的那样。我不确定如果您实际渲染到此控件会发生什么(如果有的话)。
Found the answer. I created a hidden control, set the width and the height of it appropriately and then set it as the target. Works perfect. For those who may stumble upon this later here is the code:
Thats all it takes, assuming like I said before you are rendering to a texture. I'm not sure what (if anything) would happen if you were to actually render to this control.