DirerctX9 初始化Direct3D

本文档详细介绍了如何初始化Direct3D9,包括获取IDirect3D9接口、检查硬件顶点处理能力、填充D3DPRESENT_PARAMETERS结构以及创建IDirect3DDevice9接口的过程。通过调用Direct3DCreate9函数获取接口,并使用GetDeviceCaps检查硬件特性。接着,根据硬件支持情况设置顶点处理类型。最后,详细说明了D3DPRESENT_PARAMETERS结构的各个字段及其在全屏和窗口模式下的应用,以及如何使用CreateDevice创建设备。
摘要由CSDN通过智能技术生成

Acquiring anIDirect3D9 Interface

This is easily doneusing a special Direct3D function, as the following lines of code show:

IDirect3D9*_d3d9;

_d3d9 =Direct3DCreate9(D3D_SDK_VERSION);

 

Checking for Hardware Vertex Processing

We use the followingmethod:

HRESULTIDirect3D9::GetDeviceCaps(

UINTAdapter,

D3DDEVTYPEDeviceType,

D3DCAPS9*pCaps

);

Adapter—Specifiesthe physical display adapter that we are going to get the capabilities of

DeviceType—Specifiesthe device type to use (e.g., hardware device (D3DDEVTYPE_HAL) or softwaredevice (D3DDEVTYPE_REF))

pCaps—Returnsthe initialized capabilities structure

 

Then we can checkthe capabilities, as we did in section 1.3.8. The following code snippetillustrates this:

// FillD3DCAPS9 structure with the capabilities of the

//primary display adapter.

D3DCAPS9caps;

d3d9->GetDeviceCaps(

D3DADAPTER_DEFAULT,// Denotes primary display adapter.

deviceType,// Specifies the device type, usually D3DDEVTYPE_HAL.

&caps);// Return filled D3DCAPS9 structure that contains

// thecapabilities of the primary display adapter.

// Canwe use hardware vertex processing?

int vp =0;

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值