|
|
发表于 2008-1-21 09:27:00
|
显示全部楼层
Re:XNA Shooter在我的??(nVIDIA7900GT或7300TC)上不能?绦
RenderToTexture.cs中
try
{
// Create render target of specified size.
renderTarget = new RenderTarget2D(
BaseGame.Device,
texWidth, texHeight, 1,
format,
BaseGame.MultiSampleType, BaseGame.MultiSampleQuality);
if (format != SurfaceFormat.Color)
usesHighPercisionFormat = true;
// Unsupported on Xbox360, will crash with InvalidOperationException
//obs: #if !XBOX360
// Create z buffer surface for shadow map render targets
// if they don't fit in our current resolution.
if (sizeType == SizeType.FullScreenWithZBuffer ||
sizeType == SizeType.HalfScreenWithZBuffer ||
sizeType == SizeType.ShadowMap &&
(texWidth > BaseGame.Width ||
texHeight > BaseGame.Height))
{
zBufferSurface =
new DepthStencilBuffer(
BaseGame.Device,
texWidth, texHeight,
// Lets use the same stuff as the back buffer.
BaseGame.BackBufferDepthFormat,
// Don't use multisampling, render target does not support that.
//obs: MultiSampleType.None, 0);
BaseGame.MultiSampleType, BaseGame.MultiSampleQuality);
} // if
//#endif
loaded = true;
} // try
catch (InvalidOperationException ex)
{
renderTarget = new RenderTarget2D(
BaseGame.Device,
texWidth, texHeight, 1,
format);
}
catch (Exception ex)
{
// Everything failed, make this unuseable.
Log.Write("Creating RenderToTexture failed: " + ex.ToString());
renderTarget = null;
internalXnaTexture = null;
loaded = false;
} // catch
原来的Source Code里没有具体捕捉InvalidOperationException这个错误,在我的机器上运行也是这样。。。请加入这部分的代码,当捕捉到InvalidOperationException时,继续创建renderTarget,不过请注意,使用只有5个参数的那个构造函数。。。
|
|