﻿<?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++博客-厚积薄发，滴水穿石-随笔分类-3D</title><link>http://www.cppblog.com/cokecoffe/category/18607.html</link><description /><language>zh-cn</language><lastBuildDate>Tue, 14 Feb 2012 02:18:29 GMT</lastBuildDate><pubDate>Tue, 14 Feb 2012 02:18:29 GMT</pubDate><ttl>60</ttl><item><title>渲染上下文（Rendering Context）</title><link>http://www.cppblog.com/cokecoffe/archive/2012/02/14/165540.html</link><dc:creator>Wangkeke</dc:creator><author>Wangkeke</author><pubDate>Tue, 14 Feb 2012 02:15:00 GMT</pubDate><guid>http://www.cppblog.com/cokecoffe/archive/2012/02/14/165540.html</guid><wfw:comment>http://www.cppblog.com/cokecoffe/comments/165540.html</wfw:comment><comments>http://www.cppblog.com/cokecoffe/archive/2012/02/14/165540.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/cokecoffe/comments/commentRss/165540.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/cokecoffe/services/trackbacks/165540.html</trackback:ping><description><![CDATA[<div>
<pre style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 20px; orphans: 2; text-align: left; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; background-color: #d6d3d6;"><span style="font-family: Verdana; font-size: 13px; background-color: #fffdfd;">如果把渲染引擎看做一个画家，那么画家开始作画之前需要做一系列的准备工作，譬如：布置好场景，摆好画架，钉好画布，调整好灯光，准备号画笔油彩，站好位置，然后才能开始下笔作画。前期的这一系列准备过程在d3d和ogl这样的渲染api中对应了一系列的接口函数，这些函数初看起来又多又乱，有时调用顺序还有一定的耦合，性，因此需要精心的组织这些接口，一种比较好的方法是将这些接口组织成一个叫做渲染上下文（rendering context）的类。</span></pre>
<pre style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 20px; orphans: 2; text-align: left; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; background-color: #d6d3d6;"><span style="font-family: Verdana; font-size: 13px; background-color: #fffdfd;">这个类中具体包含哪些东西呢，罗列起来可以有这些：</span></pre>
<pre style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 20px; orphans: 2; text-align: left; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; background-color: #d6d3d6;"><span style="font-family: Verdana; font-size: 13px; background-color: #fffdfd;">1. 视图设置相关（正交/投影，视口参数设置）</span></pre>
<pre style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 20px; orphans: 2; text-align: left; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; background-color: #d6d3d6;"><span style="font-family: Verdana; font-size: 13px; background-color: #fffdfd;">2. 绘制缓冲相关（创建删除缓冲，绑定缓冲，设置当前缓冲，清除缓冲，设置背景颜色）</span></pre>
<pre style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 20px; orphans: 2; text-align: left; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; background-color: #d6d3d6;"><span style="font-family: Verdana; font-size: 13px; background-color: #fffdfd;">3. 贴图参数相关（是否使用贴图，贴图Filter模式，Wrap模式，MipMap等）</span></pre>
<pre style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 20px; orphans: 2; text-align: left; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; background-color: #d6d3d6;"><span style="font-family: Verdana; font-size: 13px; background-color: #fffdfd;">4. shader相关（创建/删除shader，设置shader参数）</span></pre>
<pre style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 20px; orphans: 2; text-align: left; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; background-color: #d6d3d6;"><span style="font-family: Verdana; font-size: 13px; background-color: #fffdfd;">5. 缓冲数据相关（顶点缓冲，索引缓冲等）</span></pre>
<pre style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 20px; orphans: 2; text-align: left; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; background-color: #d6d3d6;"><span style="font-family: Verdana; font-size: 13px; background-color: #fffdfd;">6. 材质相关（diffuse，embient，specular，emit等）</span></pre>
<pre style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 20px; orphans: 2; text-align: left; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; background-color: #d6d3d6;"><span style="font-family: Verdana; font-size: 13px; background-color: #fffdfd;">7. 矩阵相关（world，view，project等，及相关旋转、平移、缩放操作）</span></pre>
<pre style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 20px; orphans: 2; text-align: left; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; background-color: #d6d3d6;"><span style="font-family: Verdana; font-size: 13px; background-color: #fffdfd;">8. 裁剪</span></pre>
<pre style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 20px; orphans: 2; text-align: left; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; background-color: #d6d3d6;"><span style="font-family: Verdana; font-size: 13px; background-color: #fffdfd;">9. alpha（blend，test）</span></pre>
<pre style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 20px; orphans: 2; text-align: left; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; background-color: #d6d3d6;"><span style="font-family: Verdana; font-size: 13px; background-color: #fffdfd;">10. stencil-test</span></pre>
<pre style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 20px; orphans: 2; text-align: left; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; background-color: #d6d3d6;"><span style="font-family: Verdana; font-size: 13px; background-color: #fffdfd;">11. fog</span></pre>
<pre style="margin-top: 5px; margin-right: auto; margin-bottom: 5px; margin-left: auto; text-indent: 0px; color: #333333; font-family: Verdana, Arial, sans-serif, 'Lucida Grande'; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 20px; orphans: 2; text-align: left; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; background-color: #d6d3d6;"><span style="font-family: Verdana; font-size: 13px; background-color: #fffdfd;">12. 灯光（启用/关闭、灯光参数）</span></pre>
</div><img src ="http://www.cppblog.com/cokecoffe/aggbug/165540.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/cokecoffe/" target="_blank">Wangkeke</a> 2012-02-14 10:15 <a href="http://www.cppblog.com/cokecoffe/archive/2012/02/14/165540.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>