Sean You

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

4.7 Summary

  • Direct3D can be thought of as a mediator between the programmer and the graphics hardware. For example, the programmer calls Direct3D functions to bind resource views to the hardware rendering pipeline, to configure the output of the rendering pipeline, and to draw 3D geometry.

  • In Direct3D 10, a Direct3D 10-capable graphics device must support the entire Direct3D 10 capability set, with few exceptions. Therefore, there is no need to do device capability checking, as there was with Direct3D 9.

  • Component Object Model (COM) is the technology that allows DirectX to be language independent and have backward compatibility. Direct3D programmers don’t need to know the details of COM and how it works; they need only to know how to acquire COM interfaces and how to release them.

  • A 1D texture is like a 1D array of data elements, a 2D texture is like a 2D array of data elements, and a 3D texture is like a 3D array of data elements. The elements of a texture must have a format described by a member of the DXGI_FORMAT enumerated type. Textures typically contain image data, but they can contain other data, too, such as depth information (e.g., the depth buffer). The GPU can do special operations on textures, such as filter and multisample them.

  • In Direct3D, resources are not bound to the pipeline directly. Instead, a resource view is bound to the pipeline. Different views of a single resource may be created. In this way, a single resource may be bound to different stages of the rendering pipeline. If a resource was created with a typeless format, then the type must be specified at view creation.

  • The ID3D10Device interface is the chief Direct3D interface and can be thought of as our software controller of the physical graphics device hardware; that is, through this interface we can interact with the hardware and instruct it to do things (such as clear the back buffer, bind resources to the various pipeline stages, and draw geometry).

  • The performance counter is a high-resolution timer that provides accurate timing measurements needed for measuring small time differentials, such as the time elapsed between frames. The performance timer works in time units called counts. The QueryPerformanceFrequency function outputs the counts per second of the performance timer, which can then be used to convert from units of counts to seconds. The current time value of the performance timer (measured in counts) is obtained with the QueryPerformanceCounter function.

  • To compute the frames per second (FPS), we count the number of frames processed over some time interval Δt. Let n be the number of frames counted over time Δt; the average frames per second over that time interval is . The frame rate can give misleading conclusions about performance; the time it takes to process a frame is more informative. The amount of time, in seconds, spent processing a frame is the reciprocal of the frame rate, i.e., 1/fpsavg.

  • To facilitate text output, the D3DX library provides the ID3DX10Font interface. A pointer to an object of this type can be obtained with the D3DX10CreateFontIndirect function. Once a pointer has been obtained, use the ID3DX10Font::DrawText method to draw a string to the screen.

  • The sample framework is used to provide a consistent interface that all demo applications in this book follow. The code provided in the d3dUtil.h, d3dApp.h, and d3dApp.cpp files wrap standard initialization code that every application must implement. By wrapping this code up, we hide it, which allows the samples to be more focused on demonstrating the current topic.

  • For debug mode builds, create the Direct3D device with the D3D10_CREATE_DEVICE_DEBUG flag to enable the debug layer. When the debug flag is specified, Direct3D will send debug messages to the VC++ output window. Also use the debug version of the D3DX library (i.e., d3dx10d.lib) for debug builds.

posted on 2010-09-20 02:42  Sean You  阅读(188)  评论(0编辑  收藏  举报