青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

天行健 君子當(dāng)自強(qiáng)而不息

Direct3D程序設(shè)計(jì)基礎(chǔ)(3)

渲染圖形

使用Direct3D繪制三維圖形和使用GDI繪制二維圖形的方法非常類似,Direct3D程序中的Direct3D設(shè)備對(duì)象相當(dāng)于GDI程序中的hdc(設(shè)備描述表),使用 GDI繪制圖形前,通常需要先利用hdc進(jìn)行相關(guān)設(shè)置,然后通過(guò)hdc進(jìn)行繪圖。同樣在Direct3D程序中通常先通過(guò)Direct3D設(shè)備接口進(jìn)行相關(guān)的渲染設(shè)備設(shè)置,然后再渲染圖形。而且所有的渲染圖形操作必須在函數(shù)BeginScene()和EndScene()之間進(jìn)行。

void render()
{
g_device->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_X#2d32aa, 1.0f, 0);
	g_device->BeginScene();
	// render game scene here 
	g_device->EndScene();
	g_device->Present(NULL, NULL, NULL, NULL);
}

IDirect3DDevice9::Clear()函數(shù)的作用是清空一個(gè)或多個(gè)表面的內(nèi)容。Direct3D在繪制圖形前,需要使用該函數(shù)清空視口(viewport)的顏色緩沖區(qū)、深度緩沖區(qū)或者模板緩沖區(qū)。

Clears one or more surfaces such as a render target, multiple render targets, a stencil buffer, and a depth buffer.

HRESULT Clear(
DWORD Count,
CONST D3DRECT * pRects,
DWORD Flags,
D3DCOLOR Color,
float Z,
DWORD Stencil
);

Parameters

Count
[in] Number of rectangles in the array at pRects. Must be set to 0 if pRects is NULL. May not be 0 if pRects is a valid pointer.
pRects
[in] Pointer to an array of D3DRECT structures that describe the rectangles to clear. Set a rectangle to the dimensions of the rendering target to clear the entire surface. Each rectangle uses screen coordinates that correspond to points on the render target. Coordinates are clipped to the bounds of the viewport rectangle. To indicate that the entire viewport rectangle is to be cleared, set this parameter to NULL and Count to 0.
Flags
[in] Combination of one or more D3DCLEAR flags that specify the surface(s) that will be cleared.
Color
[in] Clear a render target to this ARGB color.
Z
[in] Clear the depth buffer to this new z value which ranges from 0 to 1. See remarks.
Stencil
[in] Clear the stencil buffer to this new value which ranges from 0 to 2n - 1 (n is the bit depth of the stencil buffer). See remarks.

Return Values

If the method succeeds, the return value is D3D_OK. If the method fails, the return value can be: D3DERR_INVALIDCALL.

Remarks

Use this method to clear a surface including: a render target, all render targets in an MRT, a stencil buffer, or a depth buffer. Flags determines how many surfaces are cleared. Use pRects to clear a subset of a surface defined by an array of rectangles.

IDirect3DDevice9::Clear will fail if you:

  • Try to clear either the depth buffer or the stencil buffer of a render target that does not have an attached depth buffer.
  • Try to clear the stencil buffer when the depth buffer does not contain stencil data.

大多數(shù)三維圖形程序擁有2個(gè)或者更多顏色緩沖區(qū)。用于當(dāng)前屏幕刷新的顏色緩沖區(qū)稱為前臺(tái)緩沖區(qū),而將用于圖形繪制的其他顏色緩沖區(qū)稱為后臺(tái)緩沖區(qū)。同時(shí)擁有前臺(tái)緩沖區(qū)和后臺(tái)緩沖區(qū)的圖形程序可以同時(shí)進(jìn)行圖形繪制和屏幕刷新工作,系統(tǒng)的運(yùn)行性能優(yōu)于僅有單個(gè)顏色緩沖區(qū)的圖形程序。在Direct3D程序中最常見(jiàn)的情況是有一個(gè)前臺(tái)緩沖區(qū)和一個(gè)后臺(tái)緩沖區(qū)。

在繪制圖形開(kāi)始之前,必須先調(diào)用函數(shù)IDirect3DDevice9::BeginScene()函數(shù),通知Direct3D設(shè)備開(kāi)始繪制圖形(又稱渲染),否則Direct3D程序就會(huì)出錯(cuò)返回;渲染程序完成后,也必須調(diào)用函數(shù)IDirect3DDevice9::EndScene()通知Direct3D設(shè)備結(jié)束渲染。而且這兩個(gè)函數(shù)必須成對(duì)出現(xiàn),不允許嵌套和交錯(cuò)的情況發(fā)生。任何Direct3D渲染函數(shù)都必須在函數(shù)BeginScene()和函數(shù)EndScene()的中間出現(xiàn)。

Direct3D在后臺(tái)緩沖區(qū)進(jìn)行圖形繪制操作,當(dāng)所有的圖形繪制操作結(jié)束之后,調(diào)用函數(shù)IDirect3DDevice9::Present()將在后臺(tái)緩沖區(qū)繪制的內(nèi)容提交到前臺(tái)顯示,這樣繪制的圖形就顯示在屏幕上了。

Presents the contents of the next buffer in the sequence of back buffers owned by the device.

HRESULT Present(
CONST RECT * pSourceRect,
CONST RECT * pDestRect,
HWND hDestWindowOverride,
CONST RGNDATA * pDirtyRegion
);

Parameters

pSourceRect
[in] Pointer to a value that must be NULL unless the swap chain was created with D3DSWAPEFFECT_COPY. pSourceRect is a pointer to a RECT structure containing the source rectangle. If NULL, the entire source surface is presented. If the rectangle exceeds the source surface, the rectangle is clipped to the source surface.
pDestRect
[in] Pointer to a value that must be NULL unless the swap chain was created with D3DSWAPEFFECT_COPY. pDestRect is a pointer to a RECT structure containing the destination rectangle, in window client coordinates. If NULL, the entire client area is filled. If the rectangle exceeds the destination client area, the rectangle is clipped to the destination client area.
hDestWindowOverride
[in] Pointer to a destination window whose client area is taken as the target for this presentation. If this value is NULL, then the hWndDeviceWindow member of D3DPRESENT_PARAMETERS is taken.
pDirtyRegion
[in] Value must be NULL unless the swap chain was created with D3DSWAPEFFECT_COPY. For more information about swap chains, see Flipping Surfaces (Direct3D 9) and D3DSWAPEFFECT. If this value is non-NULL, the contained region is expressed in back buffer coordinates. The rectangles within the region are the minimal set of pixels that need to be updated. This method takes these rectangles into account when optimizing the presentation by copying only the pixels within the region, or some suitably expanded set of rectangles. This is an aid to optimization only, and the application should not rely on the region being copied exactly. The implementation can choose to copy the whole source rectangle.

Return Values

Possible return values include: D3D_OK or D3DERR_DEVICEREMOVED (see D3DERR).

Remarks

If necessary, a stretch operation is applied to transfer the pixels within the source rectangle to the destination rectangle in the client area of the target window.

IDirect3DDevice9::Present will fail, returning D3DERR_INVALIDCALL, if called between BeginScene and EndScene pairs unless the render target is not the current render target (such as the back buffer you get from creating an additional swap chain). This is a new behavior for Direct3D 9.


posted on 2008-04-29 14:29 lovedday 閱讀(1734) 評(píng)論(0)  編輯 收藏 引用


只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。
網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問(wèn)   Chat2DB   管理


公告

導(dǎo)航

統(tǒng)計(jì)

常用鏈接

隨筆分類(178)

3D游戲編程相關(guān)鏈接

搜索

最新評(píng)論

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            国产精品vvv| 国内精品视频666| 99国产成+人+综合+亚洲欧美| 免费在线亚洲| 农村妇女精品| 中国成人黄色视屏| 99ri日韩精品视频| 国产精品一区二区三区观看| 欧美资源在线| 久久视频免费观看| 日韩午夜中文字幕| 亚洲性线免费观看视频成熟| 国产亚洲福利社区一区| 欧美wwwwww| 欧美日韩精品三区| 久久精品视频在线观看| 久久精品国产第一区二区三区最新章节| 黄色日韩网站| 亚洲国产精品电影| 国产精品嫩草99av在线| 老司机成人在线视频| 欧美国产一区二区在线观看| 亚洲影视在线播放| 久久久久久久国产| 亚洲视频在线一区| 久久精品国产综合精品| 99国产精品国产精品久久| 亚洲欧美国产一区二区三区| 亚洲第一主播视频| 亚洲午夜精品久久| 亚洲日韩第九十九页| 亚洲综合视频1区| 亚洲精品国产精品国自产在线| 在线一区二区日韩| 亚洲国产精品一区二区www在线| 一区二区日韩欧美| 亚洲欧洲精品一区二区三区波多野1战4 | 美女啪啪无遮挡免费久久网站| 99国产精品99久久久久久粉嫩| 性高湖久久久久久久久| 日韩天堂在线视频| 久久亚洲综合色| 欧美一级免费视频| 欧美日韩一级黄| 欧美黄色日本| 激情小说另类小说亚洲欧美| 在线亚洲免费| 99视频精品免费观看| 欧美在线首页| 午夜日韩视频| 欧美日韩中文在线| 亚洲激情av在线| 亚洲高清中文字幕| 久久久久国产一区二区| 欧美在线1区| 欧美体内she精视频| 91久久嫩草影院一区二区| 在线欧美视频| 久久婷婷国产综合国色天香| 久久精品动漫| 国产一区二区三区日韩欧美| 亚洲视频大全| 性欧美超级视频| 国产精品美腿一区在线看 | 欧美一区二区私人影院日本| 欧美日韩国产成人在线91| 亚洲国产精品第一区二区| 亚洲国产专区校园欧美| 久久一区二区视频| 欧美激情免费观看| 亚洲人成网站色ww在线| 久久综合九色综合欧美就去吻| 久热精品在线| 亚洲国产一区在线| 免费日本视频一区| 亚洲日本va午夜在线影院| 日韩一区二区精品视频| 欧美日韩亚洲一区二区三区在线观看 | 国产伦精品一区二区| 亚洲欧美综合精品久久成人| 欧美一区二区三区日韩| 好吊成人免视频| 久久只有精品| 亚洲美女av黄| 亚洲欧美日韩国产综合在线| 国产欧美精品一区| 久久精品一区中文字幕| 亚洲福利电影| 一区二区三区四区蜜桃| 国产精品日韩在线| 久久精选视频| 亚洲日本va午夜在线电影| 亚洲系列中文字幕| 国色天香一区二区| 欧美黄色影院| 亚洲欧美在线aaa| 欧美成年人视频网站欧美| 日韩天天综合| 国产一区二区精品久久99| 麻豆av一区二区三区| 一区二区三区欧美| 免播放器亚洲| 亚洲一区精品电影| 在线观看欧美日本| 国产伦精品一区二区三区高清版| 欧美日韩综合| 亚洲综合日本| 欧美gay视频激情| 亚洲一区二区三区视频播放| 国产亚洲亚洲| 欧美日韩国产在线播放| 欧美一级专区| 日韩午夜中文字幕| 美女视频黄 久久| 亚洲欧美日韩另类精品一区二区三区| 国语自产精品视频在线看8查询8| 欧美激情一区二区| 久久久久久高潮国产精品视| 夜夜嗨一区二区| 亚洲高清不卡av| 久久久久久成人| 香蕉成人久久| 日韩亚洲国产欧美| 亚洲国产婷婷综合在线精品 | 亚洲免费一在线| 欧美成人午夜剧场免费观看| 午夜精品剧场| 亚洲日本中文字幕免费在线不卡| 国产日韩欧美精品一区| 欧美视频一区二区三区…| 欧美mv日韩mv国产网站| 欧美在线一区二区| 日韩网站免费观看| 欧美激情女人20p| 欧美超级免费视 在线| 久久精品一级爱片| 久久国产精品毛片| 亚洲欧美日韩一区在线| 亚洲综合不卡| 99re66热这里只有精品3直播| 韩国v欧美v日本v亚洲v| 国产亚洲一区二区三区| 国产精品国产亚洲精品看不卡15 | 欧美一区二粉嫩精品国产一线天| 一本色道久久99精品综合| 亚洲国产免费| 亚洲人人精品| 99re热精品| 正在播放亚洲一区| 中日韩美女免费视频网址在线观看 | 久久久久久网| 久久一区二区三区超碰国产精品| 久久经典综合| 卡通动漫国产精品| 男人的天堂亚洲| 亚洲韩国日本中文字幕| 亚洲七七久久综合桃花剧情介绍| 亚洲国产精品免费| 亚洲裸体视频| 亚洲女同性videos| 欧美专区在线观看一区| 久久综合中文| 欧美日本一道本在线视频| 欧美日韩亚洲综合| 国产午夜精品福利| 亚洲欧洲精品一区二区三区波多野1战4| 在线观看的日韩av| 日韩午夜免费视频| 性欧美xxxx大乳国产app| 久久久久久亚洲精品杨幂换脸 | 老司机免费视频一区二区| 久久综合导航| 亚洲人成在线免费观看| 亚洲一区二区精品在线| 久久久午夜精品| 欧美日韩精品在线播放| 国产精品羞羞答答| 亚洲国产黄色| 午夜精品婷婷| 欧美激情亚洲一区| 亚洲欧美日韩中文视频| 久久一区中文字幕| 国产精品第13页| 亚洲国产精品第一区二区| 亚洲婷婷综合久久一本伊一区| 欧美影片第一页| 亚洲三级电影全部在线观看高清| 亚洲女人小视频在线观看| 男人的天堂亚洲在线| 国产精品网红福利| 亚洲剧情一区二区| 久久久久久久久综合| 亚洲精品乱码久久久久久黑人| 欧美一区二区三区久久精品| 欧美日本国产精品| 黄网动漫久久久| 亚洲欧美制服另类日韩| 亚洲黄色成人| 久久久久久尹人网香蕉| 国产美女精品人人做人人爽|