2024年3月13日发(作者:)

Windows Phone 7 XNA开发之关于图形的配置

对于以前的XNA开发,在Windows Phone 7的XNA项目中关于图形的开发有了一

些新的变化需要我们关注,否则会出现一些不必要的麻烦。 我们知道XNA游戏

开发可以针对不同的平台进行,比如说Windows Phone 7或Xbox360之类的不同

硬件,程现的图形效果有着较大的差距,所以在4.0中就有了profile(配置)。

配置有两种方式:Reach和HiDe

对于以前的XNA开发,在Windows Phone 7的XNA项目中关于图形的开发有

了一些新的变化需要我们关注,否则会出现一些不必要的麻烦。

我们知道XNA游戏开发可以针对不同的平台进行,比如说Windows Phone 7

或Xbox360之类的不同硬件,程现的图形效果有着较大的差距,所以在4.0中就

有了profile(配置)。

配置有两种方式:Reach和HiDef,其中HiDef是针对高端硬件的,比如

Xbox360之类的硬件,而Reach则是针对底端硬件,如:Windows Phone 7手机

XNA开发的。在Microsoft Visual Studio 2010创建Windows Phone XNA项目

时,默认会设置profile为Reach方式而且我们无法选择:

而在创建Windows或Xbox360的游戏项目后,在项目属性中,可以看到游戏

配置是可以修改的:

有的时候如果在创建一个Windows或xbox360项目后,选用HiDef模式会出

现以下错误:

“没有找到合适的显卡。

找不到支持XNA Framework HiDef属性的Direct3D设备。

请验证相应的显卡已经安装。

确认桌面没有被锁定,没有其它的应用程序运行在全屏模式下。

不要在远程桌面下或是做为一个系统服务运行。

检查显示属性,确认硬件加速已经被设置为完全。”

因为如果你的项目设置了HiDef配置,但是你的计算机或硬件并不支持

Shader model3.0(SM3.0技术是DirectX 9.0C级别显卡全面支持的一项特效)与

DirectX 10。那么就会出现以上的错误。

关于Reach与HiDef的比较:

Reach HiDef

Supported platforms

(支持平台)

Windows Phone 7 系Xbox 360, 和任何

列, Xbox 360, 和任何安装有DirectX 10

安装有DirectX 9 GPUGPU的Windows PC

并支持至少shader

model 2.0的Windows

PC

2.0 (但是 Windows 3.0+ (Xbox 360

Phone 不支持自定义支持自定义shader

shaders) 扩展,例如vfetch,

但不支持Windows)

2048

512

不支持

4096

4096

256

Shader model

Max texture size

(最大纹理))

Max cubemap size

(最大多面体)

Max volume texture size

(最大立体纹理)

Non power of two textures

Conditional: cannot 支持

use wrap addressing

mode, mipmaps, or DXT

compression when the

size is not a power of

two

不支持 支持

Non power of two cubemaps

Non power of two volume

textures

Volume textures are 支持

not supported

1048575

16 和 32 bit

All of the Reach

formats, plus

HalfVector2,

HalfVector4

Max primitives per draw call

65535

Index buffer formats

(缓冲索引格式)

Vertex element formats

(Vertex元素格式)

16 bit

Color, Byte4,

Single, Vector2,

Vector3, Vector4,

Short2, Short4,

NormalizedShort2,

NormalizedShort4

Texture formats

(纹理格式)

Color, Bgr565, All of the Reach

Bgra5551, Bgra4444, formats, plus

NormalizedByte2,

NormalizedByte4,

Dxt1, Dxt3, Dxt5

Alpha8, Rg32,

Rgba64,

Rgba1010102,

Single, Vector2,

Vector4,

HalfSingle,

HalfVector2,

HalfVector4.

Floating point

texture formats

do not support

filtering.

Vertex texture formats

(Vertex纹理格式)

Vertex texturing is Single, Vector2,

not supported Vector4,

HalfSingle,

HalfVector2,

HalfVector4

部分支持 (见下)

不支持

部分支持 (见下)

Up to 4. Must all

have the same bit

depth. Supports

alpha blending

and independent

write masks per

rendertarget.

支持

支持

支持

Render target formats

(渲染目标格式)

Multiple render targets

(多次渲染目标)

Occlusion queries

Separate alpha blend

不支持

不支持

SourceBlend, not

DestinationBlend

AlphaSaturation

Only for

Max vertex streams

Max stream stride

16

255

16

255