• <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>

            關于DirectX使用的一些注意事項

            1.關于創建Direct3D設備對象
               創建Direct3D設備對象時,需要先創建Direct3D對象,然后再調用Direct3D對象的接口函數IDirect3D9::CreateDevice創建Direct3D設備對象。通過同一個Direct3D對象創建的所有Direct3D設備對象共享相同的物理資源(顯卡)。因為共享同一硬件,所以如果通過一個Direct3D對象創建多個Direct3D渲染設備對象會明顯降低系統性能。
               在創建Direct3D設備對象之前,還需要先初始化D3DPRESENT_PARAMENTERS結構,該結構用于創建Direct3D設備對象。此結構將會影響Direct3D設備的顯示方法。
                  

            D3DPRESENT_PARAMETERS

            Describes the presentation parameters.

            typedef struct D3DPRESENT_PARAMETERS {
                UINT BackBufferWidth, BackBufferHeight;
                D3DFORMAT BackBufferFormat;
                UINT BackBufferCount;
                D3DMULTISAMPLE_TYPE MultiSampleType;
                DWORD MultiSampleQuality;
                D3DSWAPEFFECT SwapEffect;
                HWND hDeviceWindow;
                BOOL Windowed;
                BOOL EnableAutoDepthStencil;
                D3DFORMAT AutoDepthStencilFormat;
                DWORD Flags;
                UINT FullScreen_RefreshRateInHz;
                UINT PresentationInterval;
            } D3DPRESENT_PARAMETERS, *LPD3DPRESENT_PARAMETERS;

            Members

            BackBufferWidth, BackBufferHeight
            Width and height of the new swap chain's back buffers, in pixels. If Windowed is FALSE (the presentation is full-screen), these values must equal the width and height of one of the enumerated display modes found through IDirect3D9::EnumAdapterModes. If Windowed is TRUE and either of these values is zero, the corresponding dimension of the client area of the hDeviceWindow (or the focus window, if hDeviceWindow is NULL) is taken.
            BackBufferFormat
            The back buffer format. For more information about formats, see D3DFORMAT. This value must be one of the render-target formats as validated by IDirect3D9::CheckDeviceType. You can use IDirect3DDevice9::GetDisplayMode to obtain the current format.

            In fact, D3DFMT_UNKNOWN can be specified for the BackBufferFormat while in windowed mode. This tells the runtime to use the current display-mode format and eliminates the need to call IDirect3DDevice9::GetDisplayMode.

            For windowed applications, the back buffer format no longer needs to match the display-mode format because color conversion can now be done by the hardware (if the hardware supports color conversion). The set of possible back buffer formats is constrained, but the runtime will allow any valid back buffer format to be presented to any desktop format. (There is the additional requirement that the device be operable in the desktop mode; devices typically do not operate in 8 bits per pixel modes.)

            Full-screen applications cannot do color conversion.

            BackBufferCount
            This value can be between 0 and D3DPRESENT_BACK_BUFFERS_MAX (or D3DPRESENT_BACK_BUFFERS_MAX_EX when using Direct3D 9Ex). Values of 0 are treated as 1. If the number of back buffers cannot be created, the runtime will fail the method call and fill this value with the number of back buffers that could be created. As a result, an application can call the method twice with the same D3DPRESENT_PARAMETERS structure and expect it to work the second time.

            The method fails if one back buffer cannot be created. The value of BackBufferCount influences what set of swap effects are allowed. Specifically, any D3DSWAPEFFECT_COPY swap effect requires that there be exactly one back buffer.

            MultiSampleType
            Member of the D3DMULTISAMPLE_TYPE enumerated type. The value must be D3DMULTISAMPLE_NONE unless SwapEffect has been set to D3DSWAPEFFECT_DISCARD. Multisampling is supported only if the swap effect is D3DSWAPEFFECT_DISCARD.
            MultiSampleQuality
            Quality level. The valid range is between zero and one less than the level returned by pQualityLevels used by IDirect3D9::CheckDeviceMultiSampleType. Passing a larger value returns the error D3DERR_INVALIDCALL. Paired values of render targets or of depth stencil surfaces and D3DMULTISAMPLE_TYPE must match.
            SwapEffect
            Member of the D3DSWAPEFFECT enumerated type. The runtime will guarantee the implied semantics concerning buffer swap behavior; therefore, if Windowed is TRUE and SwapEffect is set to D3DSWAPEFFECT_FLIP, the runtime will create one extra back buffer and copy whichever becomes the front buffer at presentation time.

            D3DSWAPEFFECT_COPY requires that BackBufferCount be set to 1.

            D3DSWAPEFFECT_DISCARD will be enforced in the debug runtime by filling any buffer with noise after it is presented.

            Differences between Direct3D9 and Direct3D9Ex

            In Direct3D9Ex, D3DSWAPEFFECT_FLIPEX is added to designate when an application is adopting flip mode. That is, whan an application's frame is passed in window's mode (instead of copied) to the Desktop Window Manager(DWM) for composition. Flip mode provides more efficient memory bandwidth and enables an application to take advantage of full-screen-present statistics. It does not change full screen behavior. Flip mode behavior is available beginning with Windows 7.

            hDeviceWindow
            The device window determines the location and size of the back buffer on screen. This is used by Direct3D when the back buffer contents are copied to the front buffer during IDirect3DDevice9::Present.
            • For a full-screen application, this is a handle to the top window (which is the focus window).

              For applications that use multiple full-screen devices (such as a multimonitor system), exactly one device can use the focus window as the device window. All other devices must have unique device windows.

            • For a windowed-mode application, this handle will be the default target window for IDirect3DDevice9::Present. If this handle is NULL, the focus window will be taken.

            Note that no attempt is made by the runtime to reflect user changes in window size. The back buffer is not implicitly reset when this window is reset. However, the IDirect3DDevice9::Present method does automatically track window position changes.

            Windowed
            TRUE if the application runs windowed; FALSE if the application runs full-screen.
            EnableAutoDepthStencil
            If this value is TRUE, Direct3D will manage depth buffers for the application. The device will create a depth-stencil buffer when it is created. The depth-stencil buffer will be automatically set as the render target of the device. When the device is reset, the depth-stencil buffer will be automatically destroyed and recreated in the new size.

            If EnableAutoDepthStencil is TRUE, then AutoDepthStencilFormat must be a valid depth-stencil format.

            AutoDepthStencilFormat
            Member of the D3DFORMAT enumerated type. The format of the automatic depth-stencil surface that the device will create. This member is ignored unless EnableAutoDepthStencil is TRUE.
            Flags
            One of the D3DPRESENTFLAG constants.
            FullScreen_RefreshRateInHz
            The rate at which the display adapter refreshes the screen. The value depends on the mode in which the application is running:
            • For windowed mode, the refresh rate must be 0.
            • For full-screen mode, the refresh rate is one of the refresh rates returned by IDirect3D9::EnumAdapterModes.
            PresentationInterval
            The maximum rate at which the swap chain's back buffers can be presented to the front buffer. For a detailed explanation of the modes and the intervals that are supported, see D3DPRESENT.

            Requirements

            Header: Declared in D3D9Types.h. 
                  幾個重要的參數加以解釋說明一下,其中BackBufferWidth和BackBufferHeight指定后臺緩存區的寬高(以像素為單位)。如果圖形以窗口方式顯示并且該成員變量被設置為0,則系統自動使用顯示窗口客戶區的寬高作為后臺緩沖區的寬高。BackBufferCount指定后臺緩沖區的數量。該值可以為0、1、2、3,其中0和1時都表示創建一個后臺緩沖區。通常使用一個后臺緩沖區和一個主緩存,主緩存將其顯示在屏幕上。

            posted on 2012-02-16 15:24 Daywei 閱讀(966) 評論(0)  編輯 收藏 引用 所屬分類: DirectX

            <2014年6月>
            25262728293031
            1234567
            891011121314
            15161718192021
            22232425262728
            293012345

            導航

            統計

            常用鏈接

            留言簿

            隨筆分類

            隨筆檔案

            文章檔案

            牛人博客

            搜索

            積分與排名

            最新評論

            閱讀排行榜

            91精品久久久久久无码| 天堂久久天堂AV色综合| 久久综合九色综合久99| 国产精品免费久久久久影院| 久久99久久无码毛片一区二区 | 国产精品久久久久久久久免费| 久久本道伊人久久| 大香伊人久久精品一区二区| 久久精品国产亚洲AV高清热| 久久天天躁狠狠躁夜夜av浪潮 | 久久人人爽人人人人片av| 新狼窝色AV性久久久久久| A级毛片无码久久精品免费| 亚洲色欲久久久综合网东京热 | 佐藤遥希在线播放一二区 | 久久99国产精品99久久| 久久精品国产免费观看三人同眠| 欧美伊香蕉久久综合类网站| 日韩人妻无码精品久久久不卡| 国产一区二区精品久久凹凸 | 色欲综合久久中文字幕网| 久久人妻少妇嫩草AV蜜桃| 久久国产精品99精品国产987| 久久亚洲AV成人无码软件| 国产精品久久久久久| 77777亚洲午夜久久多喷| 久久精品亚洲欧美日韩久久| 精品午夜久久福利大片| 久久综合给合久久国产免费 | 91精品免费久久久久久久久| 国内精品久久久久影院一蜜桃| 伊人久久无码中文字幕| 久久综合偷偷噜噜噜色| 久久亚洲AV无码西西人体| 久久九九久精品国产免费直播| 99久久无码一区人妻| 伊人久久综在合线亚洲2019| 办公室久久精品| 久久久91人妻无码精品蜜桃HD| 久久久久亚洲AV成人网人人网站 | 99国产欧美精品久久久蜜芽|