﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-狂想的天空-随笔分类-2D,3D</title><link>http://www.cppblog.com/lijinshui/category/6745.html</link><description>狂想，只要你想！</description><language>zh-cn</language><lastBuildDate>Thu, 08 Jan 2009 12:36:39 GMT</lastBuildDate><pubDate>Thu, 08 Jan 2009 12:36:39 GMT</pubDate><ttl>60</ttl><item><title>打光处理之&lt;材质&gt;</title><link>http://www.cppblog.com/lijinshui/archive/2009/01/08/71482.html</link><dc:creator>狂之想</dc:creator><author>狂之想</author><pubDate>Thu, 08 Jan 2009 04:41:00 GMT</pubDate><guid>http://www.cppblog.com/lijinshui/archive/2009/01/08/71482.html</guid><wfw:comment>http://www.cppblog.com/lijinshui/comments/71482.html</wfw:comment><comments>http://www.cppblog.com/lijinshui/archive/2009/01/08/71482.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lijinshui/comments/commentRss/71482.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lijinshui/services/trackbacks/71482.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 所谓材质，是设定[构成多边形的各顶点，要如何把光源反射过来的光源反射回去]的参数集合。<br>不过，请注意，材质不是真对顶点设定的，而是以多边形为单位进行设定。&nbsp;&nbsp;<a href='http://www.cppblog.com/lijinshui/archive/2009/01/08/71482.html'>阅读全文</a><img src ="http://www.cppblog.com/lijinshui/aggbug/71482.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lijinshui/" target="_blank">狂之想</a> 2009-01-08 12:41 <a href="http://www.cppblog.com/lijinshui/archive/2009/01/08/71482.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>打光处理</title><link>http://www.cppblog.com/lijinshui/archive/2009/01/07/71433.html</link><dc:creator>狂之想</dc:creator><author>狂之想</author><pubDate>Wed, 07 Jan 2009 12:33:00 GMT</pubDate><guid>http://www.cppblog.com/lijinshui/archive/2009/01/07/71433.html</guid><wfw:comment>http://www.cppblog.com/lijinshui/comments/71433.html</wfw:comment><comments>http://www.cppblog.com/lijinshui/archive/2009/01/07/71433.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lijinshui/comments/commentRss/71433.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lijinshui/services/trackbacks/71433.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 其实，这个功能在阴影的部分已经不常被使用，<br>但只要能善加应用的话，也是可以用在其它各种特效上面的。&nbsp;&nbsp;<a href='http://www.cppblog.com/lijinshui/archive/2009/01/07/71433.html'>阅读全文</a><img src ="http://www.cppblog.com/lijinshui/aggbug/71433.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lijinshui/" target="_blank">狂之想</a> 2009-01-07 20:33 <a href="http://www.cppblog.com/lijinshui/archive/2009/01/07/71433.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>使用矩阵控制摄像机</title><link>http://www.cppblog.com/lijinshui/archive/2008/12/30/70765.html</link><dc:creator>狂之想</dc:creator><author>狂之想</author><pubDate>Tue, 30 Dec 2008 05:45:00 GMT</pubDate><guid>http://www.cppblog.com/lijinshui/archive/2008/12/30/70765.html</guid><wfw:comment>http://www.cppblog.com/lijinshui/comments/70765.html</wfw:comment><comments>http://www.cppblog.com/lijinshui/archive/2008/12/30/70765.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lijinshui/comments/commentRss/70765.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lijinshui/services/trackbacks/70765.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 在3D绘图的世界中，我们常用到以下三种矩阵；<br><br>一，世界矩阵...模型配置(移动/旋转/缩放)<br>二，视图矩阵...摄像机的位置(移动/旋转)<br>三，投影矩阵...摄像机的参数(视角/画面比)&nbsp;&nbsp;<a href='http://www.cppblog.com/lijinshui/archive/2008/12/30/70765.html'>阅读全文</a><img src ="http://www.cppblog.com/lijinshui/aggbug/70765.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lijinshui/" target="_blank">狂之想</a> 2008-12-30 13:45 <a href="http://www.cppblog.com/lijinshui/archive/2008/12/30/70765.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>矩阵二</title><link>http://www.cppblog.com/lijinshui/archive/2008/12/20/69917.html</link><dc:creator>狂之想</dc:creator><author>狂之想</author><pubDate>Sat, 20 Dec 2008 09:42:00 GMT</pubDate><guid>http://www.cppblog.com/lijinshui/archive/2008/12/20/69917.html</guid><wfw:comment>http://www.cppblog.com/lijinshui/comments/69917.html</wfw:comment><comments>http://www.cppblog.com/lijinshui/archive/2008/12/20/69917.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lijinshui/comments/commentRss/69917.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lijinshui/services/trackbacks/69917.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 上一节，我们介绍了什么是矩阵，<br>矩阵在DirectXGraphics中的作用，<br>以及怎样用API生成不同的矩阵(缩放，移动，旋转)。<br><br>这一节，我们进一步介绍一下矩阵：<br>1>怎样生成绕任意轴旋转的矩阵。<br>2>矩阵的合成。&nbsp;&nbsp;<a href='http://www.cppblog.com/lijinshui/archive/2008/12/20/69917.html'>阅读全文</a><img src ="http://www.cppblog.com/lijinshui/aggbug/69917.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lijinshui/" target="_blank">狂之想</a> 2008-12-20 17:42 <a href="http://www.cppblog.com/lijinshui/archive/2008/12/20/69917.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>矩阵</title><link>http://www.cppblog.com/lijinshui/archive/2008/12/17/69674.html</link><dc:creator>狂之想</dc:creator><author>狂之想</author><pubDate>Wed, 17 Dec 2008 13:00:00 GMT</pubDate><guid>http://www.cppblog.com/lijinshui/archive/2008/12/17/69674.html</guid><wfw:comment>http://www.cppblog.com/lijinshui/comments/69674.html</wfw:comment><comments>http://www.cppblog.com/lijinshui/archive/2008/12/17/69674.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lijinshui/comments/commentRss/69674.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lijinshui/services/trackbacks/69674.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 在3D绘图世界，为了要设定模型的配置或摄像机的配置或是参数，<br>矩阵会频繁的使用。&nbsp;&nbsp;<a href='http://www.cppblog.com/lijinshui/archive/2008/12/17/69674.html'>阅读全文</a><img src ="http://www.cppblog.com/lijinshui/aggbug/69674.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lijinshui/" target="_blank">狂之想</a> 2008-12-17 21:00 <a href="http://www.cppblog.com/lijinshui/archive/2008/12/17/69674.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>vertex shader　之　FVF</title><link>http://www.cppblog.com/lijinshui/archive/2008/12/15/69526.html</link><dc:creator>狂之想</dc:creator><author>狂之想</author><pubDate>Mon, 15 Dec 2008 12:57:00 GMT</pubDate><guid>http://www.cppblog.com/lijinshui/archive/2008/12/15/69526.html</guid><wfw:comment>http://www.cppblog.com/lijinshui/comments/69526.html</wfw:comment><comments>http://www.cppblog.com/lijinshui/archive/2008/12/15/69526.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lijinshui/comments/commentRss/69526.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lijinshui/services/trackbacks/69526.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 本节内容，我们讲述Rendering pipeline 的vertex shader 部分的FVF<br>1>什么是FVF？<br>2>FVF的作用是什么？&nbsp;&nbsp;<a href='http://www.cppblog.com/lijinshui/archive/2008/12/15/69526.html'>阅读全文</a><img src ="http://www.cppblog.com/lijinshui/aggbug/69526.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lijinshui/" target="_blank">狂之想</a> 2008-12-15 20:57 <a href="http://www.cppblog.com/lijinshui/archive/2008/12/15/69526.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Rendering pipeline 之　alpha test, stencil test</title><link>http://www.cppblog.com/lijinshui/archive/2008/12/11/69150.html</link><dc:creator>狂之想</dc:creator><author>狂之想</author><pubDate>Thu, 11 Dec 2008 04:33:00 GMT</pubDate><guid>http://www.cppblog.com/lijinshui/archive/2008/12/11/69150.html</guid><wfw:comment>http://www.cppblog.com/lijinshui/comments/69150.html</wfw:comment><comments>http://www.cppblog.com/lijinshui/archive/2008/12/11/69150.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lijinshui/comments/commentRss/69150.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lijinshui/services/trackbacks/69150.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: alpha test处理中，会使用各像素设置的alpha值(透明度)，来决定是否描绘该像素。&nbsp;&nbsp;<a href='http://www.cppblog.com/lijinshui/archive/2008/12/11/69150.html'>阅读全文</a><img src ="http://www.cppblog.com/lijinshui/aggbug/69150.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lijinshui/" target="_blank">狂之想</a> 2008-12-11 12:33 <a href="http://www.cppblog.com/lijinshui/archive/2008/12/11/69150.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>&lt;&lt;Rendering pipeline&gt;&gt;  之 pixel shader</title><link>http://www.cppblog.com/lijinshui/archive/2008/12/03/68501.html</link><dc:creator>狂之想</dc:creator><author>狂之想</author><pubDate>Wed, 03 Dec 2008 12:33:00 GMT</pubDate><guid>http://www.cppblog.com/lijinshui/archive/2008/12/03/68501.html</guid><wfw:comment>http://www.cppblog.com/lijinshui/comments/68501.html</wfw:comment><comments>http://www.cppblog.com/lijinshui/archive/2008/12/03/68501.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lijinshui/comments/commentRss/68501.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lijinshui/services/trackbacks/68501.html</trackback:ping><description><![CDATA[模型在　<span style="background-color: yellow;">vertex shader</span>和<span style="background-color: yellow;">rasterizer</span>处理之后，<br>基本上是一个有颜色的模型了。<br>也就是说，在rasterizer处理之后，其实就已经算是一个3D的图像了。<br><br>但是，这个图像只是各个面被使用渐进色涂满而已，非常单调。<br>要想使图像的各个面上贴上别的图像，<br>或者，使各个面呈现半透明的图像，<br>就需要做其它处理。<br>这个处理，就是<span style="background-color: yellow; font-weight: bold;"><span style="color: red;">pixel shader</span></span><span style="color: red; font-weight: bold;"></span>(像素着色器)<br><br>像素着色器，就是以rasterizer所产生的各个pixel为对象来进行各种处理，<br>让单调的图像成为有各种特别效果的图像。<br><br>pixel shader的内部被分为如下图所示的区域。<br><img alt=""  src="http://www.cppblog.com/images/cppblog_com/lijinshui/004.JPG" width="795" height="220"><br><br>其中，浅蓝色区域即为像素着色器处理部分。<br>绿色部分是像素测试部分。<br><br>在这里特别需要注意的是：在面上贴上图像的<span style="background-color: yellow;">Texture Mapping</span>,<br>以及将颜色与目前已被画到rendering targer的像素产生混合的<span style="background-color: yellow;">blending</span>处理；<br><br>以上几个处理，我们会在以后的小节里详细介绍。<br><br>下面我们先简单介绍一下像素测试部分。　<br><br>上图的绿色部分即为像素测试部分。<br><br><span style="color: red; background-color: yellow;">像素测试</span>分为 <span style="background-color: yellow;">alpha test</span> ,<span style="background-color: yellow;">stencil test</span> ,<span style="background-color: yellow;">depth test</span>三部分；<br><br>depth test 是比较常用的，有时候我们也叫深度测试，或者，Z测试；<br>在这个测试中，会依据各个像素所设定的深度资料，让原本就会躲到别的像素后面去的像素不被画出来。<br><br>具体来说，首先必须要有一个能够暂时储存画面上的各像素深度资讯的depth buffer,的暂存记忆体。<br>然后，在描绘各模型的各个像素时，若它的前面已经有其它的像素被描绘的话，则不进行描绘，<br>而若没有的话，进行描绘。并更新depth buffer的深度资讯。<br>这样以来，　即使是重叠关系复杂的多边形，也不会出现奇怪的结果，会以正确的前后关系来进行描绘。<br><br>关于alpha test ,stencil test
，会在以下小节里介绍。<br><br><br><br><br><br><br><img src ="http://www.cppblog.com/lijinshui/aggbug/68501.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lijinshui/" target="_blank">狂之想</a> 2008-12-03 20:33 <a href="http://www.cppblog.com/lijinshui/archive/2008/12/03/68501.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Rendering pipeline 之　Rasterizer</title><link>http://www.cppblog.com/lijinshui/archive/2008/12/02/68367.html</link><dc:creator>狂之想</dc:creator><author>狂之想</author><pubDate>Tue, 02 Dec 2008 04:37:00 GMT</pubDate><guid>http://www.cppblog.com/lijinshui/archive/2008/12/02/68367.html</guid><wfw:comment>http://www.cppblog.com/lijinshui/comments/68367.html</wfw:comment><comments>http://www.cppblog.com/lijinshui/archive/2008/12/02/68367.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lijinshui/comments/commentRss/68367.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lijinshui/services/trackbacks/68367.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 那么，什么是rasterizer呢？<br>rasterizer在Rendering pipeline的流程中又做了些什么工作呢？<br><br>所谓rasterizer，可以理解为光栅处理器，<br>在rasterizer中，会从vertex shader所传来的已加工的顶点资料，<br>制作出组成多边形的各三角形，然后，将该三角形以pixel涂满。&nbsp;&nbsp;<a href='http://www.cppblog.com/lijinshui/archive/2008/12/02/68367.html'>阅读全文</a><img src ="http://www.cppblog.com/lijinshui/aggbug/68367.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lijinshui/" target="_blank">狂之想</a> 2008-12-02 12:37 <a href="http://www.cppblog.com/lijinshui/archive/2008/12/02/68367.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Rendering pipeline之　顶点着色器　</title><link>http://www.cppblog.com/lijinshui/archive/2008/11/23/67667.html</link><dc:creator>狂之想</dc:creator><author>狂之想</author><pubDate>Sun, 23 Nov 2008 08:06:00 GMT</pubDate><guid>http://www.cppblog.com/lijinshui/archive/2008/11/23/67667.html</guid><wfw:comment>http://www.cppblog.com/lijinshui/comments/67667.html</wfw:comment><comments>http://www.cppblog.com/lijinshui/archive/2008/11/23/67667.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lijinshui/comments/commentRss/67667.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lijinshui/services/trackbacks/67667.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 被输入到Rendering pipeline的多边形资料，<br>首先被送到Vertex shader(顶点着色器)。<br>那么，什么是顶点颜色器呢？<br>顶点着色器在整个Rendering pipeline中又有什么作用呢？&nbsp;&nbsp;<a href='http://www.cppblog.com/lijinshui/archive/2008/11/23/67667.html'>阅读全文</a><img src ="http://www.cppblog.com/lijinshui/aggbug/67667.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lijinshui/" target="_blank">狂之想</a> 2008-11-23 16:06 <a href="http://www.cppblog.com/lijinshui/archive/2008/11/23/67667.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Rendering pipeline的原理</title><link>http://www.cppblog.com/lijinshui/archive/2008/11/22/67604.html</link><dc:creator>狂之想</dc:creator><author>狂之想</author><pubDate>Sat, 22 Nov 2008 09:31:00 GMT</pubDate><guid>http://www.cppblog.com/lijinshui/archive/2008/11/22/67604.html</guid><wfw:comment>http://www.cppblog.com/lijinshui/comments/67604.html</wfw:comment><comments>http://www.cppblog.com/lijinshui/archive/2008/11/22/67604.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lijinshui/comments/commentRss/67604.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lijinshui/services/trackbacks/67604.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 如下图所示:<br><br>.....<br><br>Rendering pipeline 是以 [Rasterizer]为中心，<br>前面有Vertex shader(顶点着色器)，<br>后面有Pixel shader(像素着色器)，<br>一共三部分组成。&nbsp;&nbsp;<a href='http://www.cppblog.com/lijinshui/archive/2008/11/22/67604.html'>阅读全文</a><img src ="http://www.cppblog.com/lijinshui/aggbug/67604.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lijinshui/" target="_blank">狂之想</a> 2008-11-22 17:31 <a href="http://www.cppblog.com/lijinshui/archive/2008/11/22/67604.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Rendering pipeline的输入与输出</title><link>http://www.cppblog.com/lijinshui/archive/2008/11/22/67596.html</link><dc:creator>狂之想</dc:creator><author>狂之想</author><pubDate>Sat, 22 Nov 2008 08:37:00 GMT</pubDate><guid>http://www.cppblog.com/lijinshui/archive/2008/11/22/67596.html</guid><wfw:comment>http://www.cppblog.com/lijinshui/comments/67596.html</wfw:comment><comments>http://www.cppblog.com/lijinshui/archive/2008/11/22/67596.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lijinshui/comments/commentRss/67596.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lijinshui/services/trackbacks/67596.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 并不是任何一种多边形资料都　被输入到Rendering pipeline的，<br>Rendering pipeline所能接受的多边形是边数最少的的三角形。<br><br>因此，若我们想要把边数超过四的多边形丢到Rendering pipeline的话，必须先把它分为几个三角形；<br>将组成各三角形的顶点坐标制作成清单之后，就可以把它丢到Renderpipeline 中了。　<br><br>这些顶点资料的清单就是 Vertex Buffer(顶点缓冲区)&nbsp;&nbsp;<a href='http://www.cppblog.com/lijinshui/archive/2008/11/22/67596.html'>阅读全文</a><img src ="http://www.cppblog.com/lijinshui/aggbug/67596.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lijinshui/" target="_blank">狂之想</a> 2008-11-22 16:37 <a href="http://www.cppblog.com/lijinshui/archive/2008/11/22/67596.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Rendering pipeline(贴图管线)</title><link>http://www.cppblog.com/lijinshui/archive/2008/11/22/67590.html</link><dc:creator>狂之想</dc:creator><author>狂之想</author><pubDate>Sat, 22 Nov 2008 07:08:00 GMT</pubDate><guid>http://www.cppblog.com/lijinshui/archive/2008/11/22/67590.html</guid><wfw:comment>http://www.cppblog.com/lijinshui/comments/67590.html</wfw:comment><comments>http://www.cppblog.com/lijinshui/archive/2008/11/22/67590.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lijinshui/comments/commentRss/67590.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lijinshui/services/trackbacks/67590.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 什么是Rendering pipeline?<br>Rendering pipeline是做什么用的？<br><br>Rendering pipeline,顾名思义，就是“着色管线”，或者，更专业一些，叫做“贴图管线”。<br><br>从它的名字，我们可以看出，<br>Rendering pipeline就像是一个水管一样，<br>我们从管子的一方把资料放进去之后，<br>在里面会做一些加工(这个加工你可以暂时把它当做一个黑盒子)，<br>然后我们想要的东西就会从另一边跑出来。<br>您可以把它想像成一个进行流水作业的工厂一样。&nbsp;&nbsp;<a href='http://www.cppblog.com/lijinshui/archive/2008/11/22/67590.html'>阅读全文</a><img src ="http://www.cppblog.com/lijinshui/aggbug/67590.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lijinshui/" target="_blank">狂之想</a> 2008-11-22 15:08 <a href="http://www.cppblog.com/lijinshui/archive/2008/11/22/67590.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>D3D之像素格式</title><link>http://www.cppblog.com/lijinshui/archive/2008/04/14/47083.html</link><dc:creator>狂之想</dc:creator><author>狂之想</author><pubDate>Mon, 14 Apr 2008 15:00:00 GMT</pubDate><guid>http://www.cppblog.com/lijinshui/archive/2008/04/14/47083.html</guid><wfw:comment>http://www.cppblog.com/lijinshui/comments/47083.html</wfw:comment><comments>http://www.cppblog.com/lijinshui/archive/2008/04/14/47083.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lijinshui/comments/commentRss/47083.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lijinshui/services/trackbacks/47083.html</trackback:ping><description><![CDATA[<p><br>当我们创建一个表面或纹理时，<br>经常需要指定些Direct3D资源的像素格式。<br>它是由D3DFORMAT枚举类型的一个成员来定义的。<br><br>这里例举一部分： </p>
<p><span style="COLOR: #993300"><strong>D3DFMT_R8G8B8</strong></span>：表示一个24位像素，从左开始，8位分配给红色，8位分配给绿色，8位分配给蓝色。 </p>
<p><span style="COLOR: #993300"><strong>D3DFMT_X8R8G8B8</strong></span>：表示一个32位像素，从左开始，8位不用，8位分配给红色，8位分配给绿色，8位分配给蓝色。 </p>
<p><strong style="COLOR: #993300">D3DFMT_A8R8G8B8</strong>：表示一个32位像素，从左开始，8位为ALPHA通道，8位分配给红色，8位分配给绿色，8位分配给蓝色。 </p>
<p><strong style="COLOR: #993300">D3DFMT_A16B16G16R16F</strong>：表示一个64位浮点像素，从左开始，16位为ALPHA通道，16位分配给蓝色，16位分配给绿色，16位分配给红色。 </p>
<p><span style="COLOR: #993300"><strong>D3DFMT_A32B32G32R32F</strong></span>：表示一个128位浮点像素，从左开始，32位为ALPHA通道，32位分配给蓝色，32位分配给绿色，32位分配给红色。 </p>
<p><br>想了解全部的像素格式请查看SDK文档中的<span style="COLOR: #993300"><strong>D3DFORMAT</strong></span>部分。 <br></p>
<p><strong>注意：<br></strong><br>这前三种格式（D3DFMT_R8G8B8、D3DFMT_X8R8G8B8、D3DFMT_A8R8G8B8）是最常用并为大部分显卡所支持。<br>但浮点像素格式或其它一些类型的支持并不是很广泛，在使用它们前请先检测你的显卡，看是否支持。<br><br><br><br></p>
<img src ="http://www.cppblog.com/lijinshui/aggbug/47083.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lijinshui/" target="_blank">狂之想</a> 2008-04-14 23:00 <a href="http://www.cppblog.com/lijinshui/archive/2008/04/14/47083.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>D3D之多重采样</title><link>http://www.cppblog.com/lijinshui/archive/2008/04/14/47071.html</link><dc:creator>狂之想</dc:creator><author>狂之想</author><pubDate>Mon, 14 Apr 2008 12:34:00 GMT</pubDate><guid>http://www.cppblog.com/lijinshui/archive/2008/04/14/47071.html</guid><wfw:comment>http://www.cppblog.com/lijinshui/comments/47071.html</wfw:comment><comments>http://www.cppblog.com/lijinshui/archive/2008/04/14/47071.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lijinshui/comments/commentRss/47071.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lijinshui/services/trackbacks/47071.html</trackback:ping><description><![CDATA[<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">用像素距阵表示图像时往往会出现块状效应<span lang=EN-US>(</span></span><span lang=EN-US style="FONT-SIZE: 11pt; COLOR: #993300; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">blicky-looking</span><span lang=EN-US style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">)</span><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">，<br>多重采样技术<span lang=EN-US>(</span></span><span lang=EN-US style="FONT-SIZE: 11pt; COLOR: #993300; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">multisampling</span><span lang=EN-US style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">)</span><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">便是一项用于平滑块状图像的技术；<br></span><span style="FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">对表面进行多重采样常用于全屏反走样</span><span lang=EN-US>(<span style="COLOR: #993300">full-screen antialiasing</span>)；<br></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt"><br>D3DMULTISAMPLE_TYPE</span><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">枚举类型包含了一系列常量；用来表示对表面进行多重采样的级别。这些值包括：<span lang=EN-US><o:p></o:p></span></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; mso-list: l0 level1 lfo1; tab-stops: list 21.0pt"><span lang=EN-US style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: Wingdings; mso-font-kerning: 0pt; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings"><span style="mso-list: Ignore">l<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span lang=EN-US style="FONT-SIZE: 11pt; COLOR: #ff6600; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">D3DMULTISAMPLE_NONE</span><span lang=EN-US style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt"> </span><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">禁用多重采样<span lang=EN-US><o:p></o:p></span></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; mso-list: l0 level1 lfo1; tab-stops: list 21.0pt"><span lang=EN-US style="FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings"><span style="mso-list: Ignore">l<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span lang=EN-US style="FONT-SIZE: 11pt; COLOR: #ff6600; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">D3DMULTISAMPLE_1_SAMPLE</span><span lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt"> ...<span style="COLOR: #ff6600">D3DMULTISAMPLE_16_SAMPLE</span><span style="COLOR: black"> </span></span><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">指定了<span lang=EN-US>16</span>级的多重采样；</span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt"><o:p>&nbsp;</o:p></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">请大家先记得这个参数：<span lang=EN-US>D3DMULTISAMPLE_NONE</span>，它在<span lang=EN-US>D3D</span>初始化的过程中常用到，<span lang=EN-US><o:p></o:p></span></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">如下代码段所示：<span lang=EN-US><o:p></o:p></span></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><span lang=EN-US style="FONT-SIZE: 11pt; COLOR: blue; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">D3DPRESENT_PARAMETERS</span><span lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt"> <span style="COLOR: black">d3dpp;</span><span style="COLOR: blue"><o:p></o:p></span></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">ZeroMemory</span><span lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">(&amp;<span style="COLOR: black">d3dpp</span>,<span style="COLOR: blue">sizeof</span>(<span style="COLOR: black">D3DPRESENT_PARAMETERS</span>));<o:p></o:p></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-hansi-font-family: Verdana; mso-ascii-font-family: Verdana">其中的一个选项</span><span lang=EN-US style="FONT-SIZE: 9pt; FONT-FAMILY: Verdana"><o:p></o:p></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">d3dpp</span><span lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">.<span style="COLOR: black">MultiSampleType</span>=<span style="COLOR: #ff6600">D3DMULTISAMPLE_NONE</span>;<o:p></o:p></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span style="FONT-FAMILY: 宋体; mso-hansi-font-family: Verdana; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Verdana">我们常用</span><span lang=EN-US style="COLOR: #ff6600; FONT-FAMILY: Verdana; mso-bidi-font-size: 10.5pt">D3DMULTISAMPLE_NONE</span><span style="FONT-FAMILY: 宋体; mso-hansi-font-family: Verdana; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Verdana">表示我们禁用多重采样技术；</span><span lang=EN-US style="FONT-FAMILY: Verdana; mso-bidi-font-size: 10.5pt"><o:p></o:p></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span style="FONT-FAMILY: 宋体; mso-hansi-font-family: Verdana; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Verdana">为什么要禁用多重采样呢？</span><span lang=EN-US style="FONT-FAMILY: Verdana; mso-bidi-font-size: 10.5pt"><o:p></o:p></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span style="FONT-FAMILY: 宋体; mso-hansi-font-family: Verdana; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Verdana">这是因为该技术会显著降低程序的运行速度。</span><span lang=EN-US style="FONT-FAMILY: Verdana; mso-bidi-font-size: 10.5pt"><o:p></o:p></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span style="FONT-FAMILY: 宋体; mso-hansi-font-family: Verdana; mso-bidi-font-size: 10.5pt; mso-ascii-font-family: Verdana">如果你希望采用多重采样技术，<br>请务必使用</span><span lang=EN-US style="FONT-SIZE: 11pt; COLOR: #993300; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">IDriect3D9::CheckDeviceMultiSampleType<br></span><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">方法来检查您的图形设备是否支持你所希望采用的多重采样类型，<br>并验证由该类型的多重采样得到的图形质量水平是否理想。</span></p>
<img src ="http://www.cppblog.com/lijinshui/aggbug/47071.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lijinshui/" target="_blank">狂之想</a> 2008-04-14 20:34 <a href="http://www.cppblog.com/lijinshui/archive/2008/04/14/47071.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>D3D之Surface</title><link>http://www.cppblog.com/lijinshui/archive/2008/04/14/47069.html</link><dc:creator>狂之想</dc:creator><author>狂之想</author><pubDate>Mon, 14 Apr 2008 11:19:00 GMT</pubDate><guid>http://www.cppblog.com/lijinshui/archive/2008/04/14/47069.html</guid><wfw:comment>http://www.cppblog.com/lijinshui/comments/47069.html</wfw:comment><comments>http://www.cppblog.com/lijinshui/archive/2008/04/14/47069.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lijinshui/comments/commentRss/47069.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lijinshui/services/trackbacks/47069.html</trackback:ping><description><![CDATA[<span style="FONT-SIZE: 12pt">
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span style="FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">在进入</span><span lang=EN-US>D3D</span><span style="FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">之前，先来介绍一些基本的图型学概念和</span><span lang=EN-US>Direct3D</span><span style="FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">类型！</span></p>
<br>首先就是：<strong><span style="FONT-SIZE: 10.5pt; COLOR: #993300; FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-bidi-font-size: 12.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-ascii-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'">表面</span><br></strong>
<p class=a style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 0cm; mso-outline-level: 1; mso-list: none; tab-stops: 21.0pt"><span style="FONT-WEIGHT: normal; FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">表面，是</span><span lang=EN-US style="FONT-WEIGHT: normal; FONT-SIZE: 10.5pt">Driect3D</span><span style="FONT-WEIGHT: normal; FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">主要用于存储</span><span lang=EN-US style="FONT-WEIGHT: normal; FONT-SIZE: 10.5pt">2D</span><span style="FONT-WEIGHT: normal; FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">图像数据的一个象素距阵。</span><span lang=EN-US style="FONT-WEIGHT: normal; FONT-SIZE: 10.5pt"><o:p></o:p></span></p>
<p class=a style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 0cm; mso-outline-level: 1; mso-list: none; tab-stops: 21.0pt"><span style="FONT-WEIGHT: normal; FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">在代码中，我们用</span><span lang=EN-US style="FONT-SIZE: 10.5pt; COLOR: #993300"><strong>IDirect3Dsurface9</strong></span><span style="FONT-WEIGHT: normal; FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">来描述表面；</span><span lang=EN-US style="FONT-WEIGHT: normal; FONT-SIZE: 10.5pt"><o:p></o:p></span></p>
<p class=a style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: 0cm; mso-outline-level: 1; mso-list: none; tab-stops: 21.0pt"><span style="FONT-WEIGHT: normal; FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">该接口提供了几种直接从表面读取和写入数据的方法：</span><span lang=EN-US style="FONT-WEIGHT: normal; FONT-SIZE: 10.5pt"><o:p></o:p></span></p>
<p class=a style="MARGIN: 0cm 0cm 0pt 42pt; mso-outline-level: 1; tab-stops: list 42.0pt"><span lang=EN-US style="FONT-WEIGHT: normal; FONT-SIZE: 10.5pt; FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings"><span style="mso-list: Ignore">&#216;<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><strong><span lang=EN-US style="FONT-SIZE: 10.5pt; COLOR: #ff6600">LockRect</span><span style="FONT-SIZE: 10.5pt; COLOR: #ff6600; FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">　　：</span></strong><span style="FONT-WEIGHT: normal; FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">获取指向表面存储区的指针；</span><span lang=EN-US style="FONT-WEIGHT: normal; FONT-SIZE: 10.5pt"><o:p></o:p></span></p>
<p class=a style="MARGIN: 0cm 0cm 0pt 42pt; mso-outline-level: 1; tab-stops: list 42.0pt"><span lang=EN-US style="FONT-WEIGHT: normal; FONT-SIZE: 10.5pt; FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings"><span style="mso-list: Ignore">&#216;<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><strong><span lang=EN-US style="FONT-SIZE: 10.5pt; COLOR: #ff6600">UnlockRect</span><span style="FONT-SIZE: 10.5pt; COLOR: #ff6600; FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">　：</span></strong><span style="FONT-WEIGHT: normal; FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">解除对表面存储区的锁定，是上面配对使用；</span><span lang=EN-US style="FONT-WEIGHT: normal; FONT-SIZE: 10.5pt"><o:p></o:p></span></p>
<p class=a style="MARGIN: 0cm 0cm 0pt 42pt; mso-outline-level: 1; tab-stops: list 42.0pt"><span lang=EN-US style="FONT-WEIGHT: normal; FONT-SIZE: 10.5pt; FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings; mso-bidi-font-weight: bold"><span style="mso-list: Ignore">&#216;<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><strong><span lang=EN-US style="FONT-SIZE: 10.5pt; COLOR: #ff6600">GetDest</span><span style="FONT-SIZE: 10.5pt; COLOR: #ff6600; FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">　　</span><span style="FONT-SIZE: 10.5pt; COLOR: #ff6600"> </span><span style="FONT-SIZE: 10.5pt; COLOR: #ff6600; FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">：</span></strong><span style="FONT-WEIGHT: normal; FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">获得表面描述信息；</span><span lang=EN-US style="FONT-WEIGHT: normal; FONT-SIZE: 10.5pt; mso-bidi-font-weight: bold"><o:p></o:p></span></p>
<p class=a style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 0cm; mso-outline-level: 1; mso-list: none; tab-stops: 21.0pt"><span lang=EN-US style="FONT-WEIGHT: normal; FONT-SIZE: 10.5pt"><o:p>&nbsp;</o:p></span></p>
<p class=a style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 0cm; mso-outline-level: 1; mso-list: none; tab-stops: 21.0pt"><span style="FONT-WEIGHT: normal; FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">下面一个示例实现了锁定表面存储区以及将每个像素设为红色的代码段：</span><span lang=EN-US style="FONT-WEIGHT: normal; FONT-SIZE: 10.5pt"><o:p></o:p></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US><o:p>&nbsp;</o:p></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><span lang=EN-US style="FONT-SIZE: 11pt; COLOR: green; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">//</span><span style="FONT-SIZE: 11pt; COLOR: green; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">获得表面描述信息<span lang=EN-US><o:p></o:p></span></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><span lang=EN-US style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">D3DSURFACE_DESC</span><span lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt"> <span style="COLOR: black">surfaceDesc</span>;<o:p></o:p></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><span lang=EN-US style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">_surface</span><span lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">-&gt;<span style="COLOR: black">GetDesc</span>(&amp;<span style="COLOR: black">surfaceDesc</span>);<o:p></o:p></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><span lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt"><o:p>&nbsp;</o:p></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><span lang=EN-US style="FONT-SIZE: 11pt; COLOR: green; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">//</span><span style="FONT-SIZE: 11pt; COLOR: green; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">获得指向表面的指针<br></span><span lang=EN-US style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">D3DLOCKED_RECT</span><span lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt"> <span style="COLOR: black">lockedRect</span>;<o:p></o:p></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><span lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt"><o:p>&nbsp;</o:p></span><span lang=EN-US style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">_surface</span><span lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">-&gt;<span style="COLOR: black">LockRect</span>(&amp;<span style="COLOR: black">lockedRect</span>,<span style="COLOR: green">//<o:p></o:p></span></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><span lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt"><span style="mso-tab-count: 4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="mso-spacerun: yes">&nbsp;&nbsp; </span>0,<span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="COLOR: green">//<o:p></o:p></span></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><span lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt"><span style="mso-tab-count: 4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="mso-spacerun: yes">&nbsp;&nbsp; </span>0<span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="COLOR: green">//<o:p></o:p></span></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><span lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt"><span style="mso-tab-count: 4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="mso-spacerun: yes">&nbsp;&nbsp; </span>); <o:p></o:p></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><span lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt"><o:p>&nbsp;</o:p></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><span lang=EN-US style="FONT-SIZE: 11pt; COLOR: green; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">//</span><span style="FONT-SIZE: 11pt; COLOR: green; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">把每个像素都设置成红色<br></span><span lang=EN-US style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">DWORD</span><span lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt"> * <span style="COLOR: black">imageDate</span> = (<span style="COLOR: black">DWORD</span>*)<span style="COLOR: black">lockedRect</span>.<span style="COLOR: black">pBits</span>;<o:p></o:p></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><span lang=EN-US style="FONT-SIZE: 11pt; COLOR: blue; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">for</span><span lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt"> (<span style="COLOR: blue">int</span> <span style="COLOR: black">i</span> = 0; <span style="COLOR: black">i</span> &lt;<span style="COLOR: black">surfaceDesc</span>.<span style="COLOR: black">Height</span>; <span style="COLOR: black">i</span>++)<o:p></o:p></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><span lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">{<o:p></o:p></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><span lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </span><span style="COLOR: blue">for</span> (<span style="COLOR: blue">int</span> <span style="COLOR: black">j</span> = 0 ; <span style="COLOR: black">j</span> &lt;<span style="COLOR: black">surfaceDesc</span>.<span style="COLOR: black">Width</span>; <span style="COLOR: black">j</span>++)<o:p></o:p></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><span lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </span>{<o:p></o:p></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><span lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt"><span style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="COLOR: blue">int</span> <span style="COLOR: black">index</span> = <span style="COLOR: black">i</span> * <span style="COLOR: black">lockedRect</span>.<span style="COLOR: black">Pitch</span>/4 +<span style="COLOR: black">j</span>;<o:p></o:p></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><span lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt"><span style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="COLOR: black">imageDate</span>[<span style="COLOR: black">index</span>] = 0xffff0000;<span style="COLOR: green">//red<o:p></o:p></span></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><span lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </span>}<o:p></o:p></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><span lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">}<br><o:p><br></p>
<span lang=EN-US style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><span lang=EN-US style="FONT-SIZE: 11pt; COLOR: green; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">//</span><span style="FONT-SIZE: 11pt; COLOR: green; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">解除锁定<br></span><span lang=EN-US style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">_surface</span><span lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">-&gt;<span style="COLOR: black">UnlockRect</span>();<o:p></o:p></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><br><br>注：<br>结构D3DLOCKED_RECT定义如下<br></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><span lang=EN-US style="FONT-SIZE: 11pt; COLOR: blue; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">typedef</span><span lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt"> <span style="COLOR: blue">struct</span> <span style="COLOR: black">_D3DLOCED_RECT<o:p></o:p></span></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><span lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">{<o:p></o:p></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><span lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </span><span style="COLOR: black">INT</span> <span style="COLOR: black">pitch</span>;<span style="mso-spacerun: yes">&nbsp; </span><span style="COLOR: green">//</span></span><span style="FONT-SIZE: 11pt; COLOR: green; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">表面跨度<span lang=EN-US><o:p></o:p></span></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><span lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </span><span style="COLOR: blue">void</span> *<span style="COLOR: black">pBits</span>;<span style="COLOR: green">//</span></span><span style="FONT-SIZE: 11pt; COLOR: green; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">指向锁定表面内存开始地方的指针<span lang=EN-US><o:p></o:p></span></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><span lang=EN-US style="FONT-SIZE: 11pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">}<span style="COLOR: black">D3DLOCKED_RECT</span></span></p>
<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt"></span>&nbsp;</p>
</o:p></span></span>
<img src ="http://www.cppblog.com/lijinshui/aggbug/47069.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lijinshui/" target="_blank">狂之想</a> 2008-04-14 19:19 <a href="http://www.cppblog.com/lijinshui/archive/2008/04/14/47069.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>跟我一起学D3D </title><link>http://www.cppblog.com/lijinshui/archive/2008/04/14/47061.html</link><dc:creator>狂之想</dc:creator><author>狂之想</author><pubDate>Mon, 14 Apr 2008 09:42:00 GMT</pubDate><guid>http://www.cppblog.com/lijinshui/archive/2008/04/14/47061.html</guid><wfw:comment>http://www.cppblog.com/lijinshui/comments/47061.html</wfw:comment><comments>http://www.cppblog.com/lijinshui/archive/2008/04/14/47061.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/lijinshui/comments/commentRss/47061.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/lijinshui/services/trackbacks/47061.html</trackback:ping><description><![CDATA[<p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><span lang=EN-US style="FONT-SIZE: 11pt; COLOR: green; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt"><font color=#000000>最近一段时间一直在学习D3D，对于D3D，还只是新手；<br>我想，现在应该有很多朋友像我一样，<br>或者因为学习，或者因为工作，在学这一块吧！<br><br>下面一系列笔记，是我学习D3D的经历，<br>记录下来，就当是和大家共勉！<br>希望现在和我一样的朋友共同努力，共同进步！<br>当然，笔记中肯定有很多不足和遗漏之处，还望过来人指点一二，以勉误人子弟，诒笑后人了！:)<br><br>呵呵，当然，如果在这里可以认识更多志同道合的朋友，不甚荣幸！<br>我的</font><a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#108;&#105;&#106;&#105;&#110;&#115;&#64;&#104;&#111;&#116;&#109;&#97;&#105;&#108;&#46;&#99;&#111;&#109;"><font color=#2e9ce9>MSN</font><font color=#000000>：</font><font color=#2e9ce9>lijins@hotmail.com</font></a><br><font color=#000000>目前在上海从事同网络游戏相关的开发工作，希望更多的和同行的朋友多多交流！<img src="http://www.cppblog.com/CuteSoft_Client/CuteEditor/images/emsmile.gif" align=absMiddle border=0><br></font><a href="http://www.cppblog.com/lijinshui/"><font color=#2e9ce9>狂之想</font></a></span></p>
<img src ="http://www.cppblog.com/lijinshui/aggbug/47061.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/lijinshui/" target="_blank">狂之想</a> 2008-04-14 17:42 <a href="http://www.cppblog.com/lijinshui/archive/2008/04/14/47061.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>