【问题标题】:Running XNA On Lower-End Graphics Card在低端显卡上运行 XNA
【发布时间】:2011-10-30 01:12:22
【问题描述】:

我希望使用 XNA 框架开发一些简单的 2D 游戏。我特别希望能够使用我的上网本在旅途中开发和调试这些游戏的一部分。不幸的是,我上网本的 GPU 不支持 XNA 所需的 Shader Model 2.0。

沮丧,我去谷歌寻找替代品。我从“Riemers XNA Tutorial”中发现了一种替代方法。下面的代码应该强制 XNA 严格通过计算机的 CPU 运行,从而允许我的上网本运行非常慢的 XNA 版本。

if (GraphicsAdapter.DefaultAdapter.GetCapabilities(DeviceType.Hardware).MaxPixelShaderProfile < ShaderProfile.PS_2_0)
            graphics.PreparingDeviceSettings += new EventHandler<PreparingDeviceSettingsEventArgs> (SetToReference);
     }

     void SetToReference(object sender, PreparingDeviceSettingsEventArgs eventargs)
     {
         eventargs.GraphicsDeviceInformation.CreationOptions = CreateOptions.SoftwareVertexProcessing;
         eventargs.GraphicsDeviceInformation.DeviceType = DeviceType.Reference;
         eventargs.GraphicsDeviceInformation.PresentationParameters.MultiSampleType = MultiSampleType.None;
     }

上面的代码应该放在默认 XNA 项目的 Game1 方法中。

问题是当我尝试运行这个新项目时,我收到以下两个错误:

Error   1   'XNAReferenceDevice.Game1.LoadGraphicsContent(bool)': no suitable method found to override  c:\users\richard\documents\visual studio 2010\Projects\WindowsGame1\WindowsGame1\WindowsGame1\Game1.cs  39  33  WindowsGame1

Error   2   'XNAReferenceDevice.Game1.UnloadGraphicsContent(bool)': no suitable method found to override    c:\users\richard\documents\visual studio 2010\Projects\WindowsGame1\WindowsGame1\WindowsGame1\Game1.cs  46  33  WindowsGame1

这两个错误还会导致蓝色“波浪”线出现在 LoadGraphicsContent 和 UnloadGraphicsContent 方法下方。

如果有人可以帮助我解决这个问题或为我指明不同的方向,那就太好了。

提前致谢!

【问题讨论】:

    标签: graphics xna gpu


    【解决方案1】:

    新版本的 XNA 失去了与过去的一些兼容性。 可能您使用的框架和 XNA 版本比 Riemers 教程更新。

    但是,考虑到新的 XNA 4.0 支持最低像素着色器 2.0!这意味着你不能在只有像素着色器 1.1 或像素着色器 2.0 太慢的低端机器上运行它。

    以前的版本,XNA 3.1,支持最低像素着色器 1.1,您可以尝试使用 Visual Studio 2008 Express 切换回该版本。

    抱歉,由于 XNA 需要好的机器,我认为您应该找一台更好的机器,也可以用于制作 2D 图形。

    编译器错误与像素着色器无关,但可能与 XNA 和 C# 版本有关。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多