how can i use content manager in console aplication to load a new Model?

梦想与她 提交于 2019-12-12 06:27:02

问题


how can i use content manager in console application to load a new Model?

I want to load mesh data without any display ?


回答1:


Check out my answer to this question. It contains code for getting a ContentManager working in a console application.

To duplicate it here briefly:

You need the ServiceContainer and GraphicsDeviceService classes from the WinForms sample. Then just use this code:

Form form = new Form(); // Dummy form for creating a graphics device
GraphicsDeviceService gds = GraphicsDeviceService.AddRef(form.Handle,
        form.ClientSize.Width, form.ClientSize.Height);

ServiceContainer services = new ServiceContainer();
services.AddService<IGraphicsDeviceService>(gds);
content = new ContentManager(services, "Content");

And, of course, include the necessary references (System.Windows.Forms.dll).



来源:https://stackoverflow.com/questions/4814257/how-can-i-use-content-manager-in-console-aplication-to-load-a-new-model

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!