3D游戏编程入门经典(27)

安之若素 分享 2021-06-02 下载文档

/// to allow the application to modify the device settings. the supplied

/// settings parameter contains the settings that the framework has

/// selected for the new device, and the application can make any desired

/// changes directly to this structure. note however that the sample

/// framework will not correct invalid device settings so care must

/// be taken to return valid device settings; otherwise, creating the

/// device will fail.

///

public void modifydevicesettings(devicesettings settings, caps caps)

{

// this application is designed to work on a pure device by not using

// any get methods,so create a pure device if supported and using hwvp.

if ( (caps.devicecaps.supportspuredevice) &&

((settings.behaviorflags & createflags.hardwarevertex

processing) != 0 ) )

settings.behaviorflags |= createflags.puredevice;

}

查看声明的第一个方法,isdeviceacceptable方法。当样本框架忙于枚举系统中的设备时,它为所发现的每一个组合调用了该方法。注意该方法是如何返回一个布尔值的。通过这个返回值可以向样本框架指出该设备是否满足需求。然而,在您查看第一个方法中的代码之前,注意已经声明的第二个方法,modifydevicesettings。在创建设备之前样本框架会调用该方法,使您能够选择您需要的任何选项。仔细选择这些选项,因为这可能造成设备创建失败。

现在,回到第一个方法。首先查看它的参数。第一个参数的类型是caps,是capabilities的缩写。该结构用于保存关于特定设备的信息,这些信息将帮助您确定该设备是否是您希望使用的设备类型。后面两个参数是该设备的专用格式:一个用于反向缓冲区,另一个用于设备的格式。

3D游戏编程入门经典(27).doc 将本文的Word文档下载到电脑

下一篇:C15048互联网金融的发展趋势 课后测验

相关推荐
相关阅读
本类排行
× 游客快捷下载通道(下载后可以自由复制和排版)

下载本文档需要支付 7

支付方式:

开通VIP包月会员 特价:29元/月

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:xxxxxx QQ:xxxxxx