joeycih

热爱游戏

2009年8月18日 #

D3D学习记录(二)——D3DPRESENT_PARAMETERS中的BackBufferFormat

让我们来看看DirectX的API文档
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.
关于背景缓冲格式。更多的信息请参阅D3DFORMAT。这个值必须属于可用的IDirect3D9::CheckDeviceType渲染-目标格式。你可以通过使用IDirect3DDevice9::GetDisplayMode 来获取当前格式。
 

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.

         事实上,D3DFMT_UNKNOWN可以用来使用当在窗口模式下时,这会告诉计算机去使用当前的显示模式格式从而避免去调用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.

对于窗口应用程序,背景缓冲格式不再需要去符合显示模式格式因为颜色变化现在会被硬件完成(如果硬件支持颜色转换)。这样可能使背景缓冲格式受到限制,但是计算机将会允许任何有效的背景缓冲格式出现在任何的桌面格式(这里有一个附加要求device必须是可操作的在桌面模式中,device通常不会操作在8位像素模式)。

对于全屏程序是不需要颜色转换的

posted @ 2009-08-18 18:34 joeycih 阅读(884) | 评论 (0)编辑 收藏

2009年8月11日 #

6种基本图元-Primitive

Primitives

图元
A 3D primitive is a collection of vertices that form a single 3D entity. The simplest primitive is a collection of points in a 3D coordinate system, which is called a point list.
一个3D图元是一个顶点的集合来自一个单一的3D实体。最简单的图元是一个集合的点在3D坐标系中,那被叫做点集合。

Often, 3D primitives are polygons. A polygon is a closed 3D figure delineated by at least three vertices. The simplest polygon is a triangle. Microsoft Direct3D uses triangles to compose most of its polygons because all three vertices in a triangle are guaranteed to be coplanar. Rendering nonplanar vertices is inefficient. You can combine triangles to form large, complex polygons and meshes.

通常,3D图元是多边形的,一个多边形是一个由三个顶点组成的闭合的3D图形,最简单的多边形是三角形。Direct3D用三角形去组成大多数多边形是因为三角形中的所有三个顶点是一定共面的。渲染不共面的顶点是低效的。你可以组合三角形去形成更大、更复杂的多边形和网格

Direct3D定义了6中基本图元。

Defines the primitives supported by Direct3D.

typedef enum D3DPRIMITIVETYPE
{
D3DPT_POINTLIST = 1,
D3DPT_LINELIST = 2,
D3DPT_LINESTRIP = 3,
D3DPT_TRIANGLELIST = 4,
D3DPT_TRIANGLESTRIP = 5,
D3DPT_TRIANGLEFAN = 6,
D3DPT_FORCE_DWORD = 0x7fffffff,
} D3DPRIMITIVETYPE, *LPD3DPRIMITIVETYPE;

D3DPT_POINTLIST
Renders the vertices as a collection of isolated points. This value is unsupported for indexed primitives.
D3DPT_LINELIST
Renders the vertices as a list of isolated straight line segments.
D3DPT_LINESTRIP
Renders the vertices as a single polyline.
D3DPT_TRIANGLELIST

     Renders the specified vertices as a sequence of isolated triangles. Each group of three vertices defines a separate triangle.

Back-face culling is affected by the current winding-order render state.  
D3DPT_TRIANGLESTRIP
Renders the vertices as a triangle strip. The backface-culling flag is automatically flipped on even-numbered triangles.
D3DPT_TRIANGLEFAN
Renders the vertices as a triangle fan.
D3DPT_FORCE_DWORD
Forces this enumeration to compile to 32 bits in size. Without this value, some compilers would allow this enumeration to
compile to a size other than 32 bits. This value is not used.

posted @ 2009-08-11 14:44 joeycih 阅读(968) | 评论 (0)编辑 收藏

仅列出标题