您的位置:首页 > 电脑网络 > 电脑配件 > DirectX9示例程序(11)-Alpha通道

DirectX9示例程序(11)-Alpha通道

luyued 发布于 2011-04-20 23:16   浏览 N 次  



释放三个com对象一个类对象



Cube类,实现基本的drawprimitive操作










Cube类的实现,很简单



因为每帧都要改变Cube的旋转,所以在这里设置世界变换。渲染阶段首先画出背景,然后调用Cube::draw()画出Cube。注意在画Cube之前,首先令D3DRS_ALPHABLENDENABLE为true,画完之后令D3DRS_ALPHABLENDENABLE为false

全局变量



首先创建背景的vertexbuffer并填充数据,然后new一个Cube对象,创建两个纹理对象,然后设置纹理的放大、缩小和mipmap算法,在设置alpha通道的一些东西,最后设置view变换和投影变换。

科普:What's DDS File?

The DirectX Texture tool-DxTex's native file format is called "DDS" file format because it encapsulates the information in a DirectDrawSurface.

This format is easy to read and write and supports features such as alpha (Pixel opacity info) and multiple mipmap levels, as well as DXTn compression.

The DDS file format is used to store textures and cubic environment maps, both with and without mipmap levels. This format can store uncompressed and compressed pixel formats, and is the preferred file format for storing DXTn compressed data. Other than DxTex, this file format is supported by some third party tools, and by the Direct3D extensions (D3DX) library.

这里有解释:http://www.cppblog.com/AstaTus/archive/2008/10/08/62640.html

图文资讯
广告赞助商