GoblinXNA:更改屏幕分辨率时出现异常

时间:2012-06-07 16:00:54

标签: c# xna

我在我的GoblinXNA程序中面临一个问题,即屏幕分辨率,如果我使用480 * 640一切都很好,我的应用程序运行正常

captureDevice.InitVideoCapture(0, FrameRate._60Hz, Resolution._640x480,
                ImageFormat.R8G8B8_24, false);

但如果我将其更改为800x600或1280x1024,请执行以下操作:

captureDevice.InitVideoCapture(0, FrameRate._60Hz, Resolution._800x600, ImageFormat.R8G8B8_24, false);

我得到例外

GoblinXNA.GoblinException was unhandled
  Message=Could not start video stream
Could not setup graph
Error HRESULT E_FAIL has been returned from a call to a COM component.
  Source=GoblinXNA
  StackTrace:
       at GoblinXNA.Device.Capture.DirectShowCapture.StartupVideo(UCOMIMoniker mon) in C:\GoblinXNAv4.0\src\Device\Capture\DirectShowCapture.cs:line 576
       at GoblinXNA.Device.Capture.DirectShowCapture.InitVideoCapture(Int32 videoDeviceID, FrameRate framerate, Resolution resolution, ImageFormat format, Boolean grayscale) in C:\GoblinXNAv4.0\src\Device\Capture\DirectShowCapture.cs:line 276
       at Se.HInitialize(Scene scene) in C:\Se\H.cs:line 119
       at Se.App.Initialize() in C:\Se\App.cs:line 96
       at Microsoft.Xna.Framework.Game.RunGame(Boolean useBlockingRun)
       at Microsoft.Xna.Framework.Game.Run()
       at Se.Program.Main(String[] args) in C:\Se\Program.cs:line 15
  InnerException: 

任何想法如何解决这个问题?

谢谢

1 个答案:

答案 0 :(得分:0)

我设法通过将DirectShowCapture.cs中的分辨率更改为1280x720并重新编译GoblinXNA.dll来解决问题