DirectX9函数:IDirect3DDevice9::Clear 方法

清除视口或设置视口矩形, 对指定的RGBA颜色, 清除深度缓冲, 并抹掉模板缓冲区.

 

 

语法

HRESULT Clear(      

    DWORD Count,     const D3DRECT *pRects,     DWORD Flags,     D3DCOLOR Color,     float Z,     DWORD Stencil );

参数

Count
[in]  pRects中矩形的数量. 如果你设置 pRects 为NULL, 此参数必须设置为0.
pRects
[in] 描述所有要清除的矩形的 D3DRECT 结构指针. 设定一个定义要清除的目标的矩形,以清除整个表面. 每个矩形使用屏幕坐标,坐标对应要渲染的目标表面的点. 坐标被视口矩形的边缘所裁剪. 此参数也可以设置为NULL指出视口所有矩形都要清除.
Flags
[in] 指明要清除的表面. 至少取下面的一个或几个结合.
D3DCLEAR_STENCIL
清除模板缓冲区为 Stencil 参数指定的值.
D3DCLEAR_TARGET
清除要渲染目标的颜色为 Color 参数的值.
D3DCLEAR_ZBUFFER
清除深度缓冲的值为 Z 参数的值.
Color
[in] 一个32为ARGB 颜色值.
Z
[in] 要设置深度缓冲区的值. 此参数取值从0.0到 1.0 (for z-based or w-based depth buffers). 值为 0.0 代表视点最近的距离,而 1.0 代表最远距离.
Stencil
[in] 长整型,在每个模板缓冲区入口中. 参数取值应从 0到 2 n–1,  n 是模板缓冲区的位深度.

返回值

 

如果执行成功,返回值是D3D_OK.

如果执行失败, 返回值是D3DERR_INVALIDCALL.

备注

This method fails if you specify the D3DCLEAR_ZBUFFER or D3DCLEAR_STENCIL flags when the render target does not have an attached depth buffer. Similarly, if you specify the D3DCLEAR_STENCIL flag when the depth-buffer format does not contain stencil buffer information, this method fails.

你可能感兴趣的:(null,buffer)