⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tutorial_46.htm

📁 如果你相信它就好好学学吧,同样这里也只是个入门
💻 HTM
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><!-- 这篇文章由Dancingwind翻译,作者的联系方式zhouwei02@mails.tsinghua.edu.cn --><title>NeHe OpenGL教程第四十六课,DancingWind翻译</title>


<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
A:active {
	BACKGROUND: none transparent scroll repeat 0% 0%; COLOR: #bbccff; TEXT-DECORATION: none
}
A:link {
	BACKGROUND: none transparent scroll repeat 0% 0%; COLOR: #bbccff; TEXT-DECORATION: none
}
A:visited {
	BACKGROUND: none transparent scroll repeat 0% 0%; COLOR: #bbccff; TEXT-DECORATION: none
}
A:hover {
	BACKGROUND: none transparent scroll repeat 0% 0%; COLOR: #ffda6a; TEXT-DECORATION: none
}
BODY {
	COLOR: #ffffff; BACKGROUND-COLOR: #000000
}
TD IMG {
	DISPLAY: block
}
.back {
	BACKGROUND: #000022; COLOR: #ffffff
}
.back2 {
	BACKGROUND: #000000; COLOR: #ffffff
}
.back3 {
	BACKGROUND: #000022; COLOR: #ffffff
}
.copy {
	FONT-SIZE: 11px; LINE-HEIGHT: normal; FONT-STYLE: normal; FONT-FAMILY: Tahoma, Verdana, sans-serif; FONT-VARIANT: normal; TEXT-DECORATION: none
}
.head {
	FONT: bold 13px Tahoma, Verdana, sans-serif; TEXT-DECORATION: none
}
.link {
	FONT-SIZE: 14px; LINE-HEIGHT: normal; FONT-STYLE: normal; FONT-FAMILY: Tahoma, Verdana, sans-serif; FONT-VARIANT: normal; TEXT-DECORATION: none
}
.menu {
	FONT: bold 17px Tahoma, Verdana, sans-serif; TEXT-DECORATION: none
}
.news {
	BACKGROUND: #00008b; COLOR: #ffffff
}
.tab {
	PADDING-LEFT: 35px
}
.text {
	FONT-SIZE: 12px; LINE-HEIGHT: normal; FONT-STYLE: normal; FONT-FAMILY: Tahoma, Verdana, sans-serif; FONT-VARIANT: normal; TEXT-DECORATION: none
}
.theme {
	BACKGROUND: none transparent scroll repeat 0% 0%; COLOR: #bbccff
}
.dotted {
	BORDER-RIGHT: #00008b 2px dotted; BORDER-TOP: #00008b 2px dotted; BORDER-LEFT: #00008b 2px dotted; BORDER-BOTTOM: #00008b 2px dotted
}
.solid {
	BORDER-RIGHT: #ffffff 1px solid; BORDER-TOP: #ffffff 1px solid; BORDER-LEFT: #ffffff 1px solid; BORDER-BOTTOM: #ffffff 1px solid
}
.logo {
	BACKGROUND-IMAGE: url(../graphics/rgb/logo.jpg)
}
.menubar {
	BACKGROUND-IMAGE: url(../graphics/rgb/menubar.jpg)
}
.menubg {
	BACKGROUND-IMAGE: url(../graphics/rgb/menubg.jpg)
}
.menuheading {
	BACKGROUND-IMAGE: url(../graphics/rgb/menuheading.jpg)
}
.nehebutton {
	BACKGROUND-IMAGE: url(../graphics/rgb/nehebutton.jpg)
}
.newslogo {
	BACKGROUND-IMAGE: url(../graphics/rgb/newslogo.jpg)
}
.tinylogo {
	BACKGROUND-IMAGE: url(../graphics/rgb/border/tinylogo.jpg)
}
.bc {
	BACKGROUND-IMAGE:  url(../Pic/bc.png)
}
.bl {
	BACKGROUND-IMAGE:  url(../Pic/bl.png)
}
.br {
	BACKGROUND-IMAGE:  url(../Pic/br.png)
}
.c {
	BACKGROUND-IMAGE: url(../Picc.png)
}
.l {
	BACKGROUND-IMAGE:  url(../Pic/l.png)
}
.lc {
	BACKGROUND-IMAGE: url(../Piclc.png)
}
.r {
	BACKGROUND-IMAGE:  url(../Pic/r.png)
}
.rc {
	BACKGROUND-IMAGE: url(../Picrc.png)
}
.tc {
	BACKGROUND-IMAGE:  url(../Pic/tc.png)
}
.tl {
	BACKGROUND-IMAGE:  url(../Pic/tl.png)
}
.tr {
	BACKGROUND-IMAGE:  url(../Pic/tr.png)
}

</style></head><body bgcolor="black" link="#aaccff" text="white" vlink="#aaccff">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
  <tbody>
  <tr>
    <td class="tinylogo" height="130" width="326"><img alt="NeHe Productions" src="Tutorial_46_files/logo.png" height="130" width="326"></td>
      <td align="center" valign="center"><div align="center"><font class="text"><font class="theme" size="+3"><b><i>第46课</i></b></font></font></div></td>
  </tr></tbody></table>
  <!-- 上边框-->
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
  <tr>
    <td><img src="Tutorial_46_files/tl.jpg" height="28" width="28"></td>
    <td width="100%"><img src="Tutorial_46_files/tc.gif" height="28" width="100%"></td>
    <td><img src="Tutorial_46_files/tr.gif" height="28" width="28"></td>
  </tr>
</tbody>
</table>

<!-- 中部-->
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
  <tr>
  	<!-- 中部左边框-->
    <td background="Tutorial_46_files/l.gif"><img src="Tutorial_46_files/l.gif" height="28" width="28"></td>
	<!-- 中部文字部分-->
    <td valign="top" width="100%">
	<table border="0" width="100%">
          <tbody><tr>
            <td width="30%"><img src="Tutorial_46_files/lesson46.jpg" height="180" width="240"></td>
            <td width="70%"><p><font><b>全屏反走样</b></font></p>
              <p><font size="3">当今显卡的强大功能,你几乎什么都不用做,只需要在创建窗口的时候该一个数据。看看吧,驱动程序为你做完了一切。</font></p></td>
          </tr>
     </tbody></table>
      </td>
	<!-- 中部右边框-->
    <td background="Tutorial_46_files/r.gif"><img src="Tutorial_46_files/r.gif" height="28" width="28"></td>
  </tr>
</tbody>
</table>

<!-- 下边框-->
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
  <tr>
    <td><img src="Tutorial_46_files/bl.gif" height="28" width="28"></td>
    <td width="100%"><img src="Tutorial_46_files/bc.gif" height="28" width="100%"></td>
    <td><img src="Tutorial_46_files/br.gif" height="28" width="28"></td>
  </tr>
</tbody>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
  <tbody>
  <tr>
    <td class="tl"><img alt="" src="Tutorial_46_files/blank1.gif" height="28" width="28"></td>
    <td class="tc" width="100%"><img alt="" src="Tutorial_46_files/blank1.gif" height="28" width="100%"></td>
    <td class="tr"><img alt="" src="Tutorial_46_files/blank1.gif" height="28" width="28"></td></tr></tbody></table>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
  <tbody>
  <tr>
    <td class="l"><img alt="" src="Tutorial_46_files/blank1.gif" height="28" width="28"></td>
      <td class="back3" valign="top" width="100%">在图形的绘制中,直线的走样是非常影响美观的,我们可以使用反走样解决这个问题。在众多的解决方案里,多重采样是一种易于硬件实现的方法,也是一种快速的方法。<br>
        全凭多重采样可以使你的图形看起来更美观,我们可以使用ARB_MULTISAMPLE扩展完成这个功能,但它会降低你的程序的速度。
<p>&nbsp;</p>
      <p>&nbsp;</p>
    </td>
    <td class="r"><img alt="" src="Tutorial_46_files/blank1.gif" height="28" width="28"></td></tr></tbody></table>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
  <tbody>
  <tr>
    <td class="bl"><img alt="" src="Tutorial_46_files/blank1.gif" height="28" width="28"></td>
    <td class="bc" width="100%"><img alt="" src="Tutorial_46_files/blank1.gif" height="28" width="28"></td>
    <td class="br"><img alt="" src="Tutorial_46_files/blank1.gif" height="28" width="28"></td></tr></tbody></table>
<pre>Vid_mem = sizeof(Front_buffer) + sizeof(Back_buffer) + num_samples<br>		* (sizeof(Front_buffer) +sizeof(ZS_buffer))<br></pre>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
  <tbody>
  <tr>
    <td class="tl"><img alt="" src="Tutorial_46_files/blank1.gif" height="28" width="28"></td>
    <td class="tc" width="100%"><img alt="" src="Tutorial_46_files/blank1.gif" height="28" width="100%"></td>
    <td class="tr"><img alt="" src="Tutorial_46_files/blank1.gif" height="28" width="28"></td></tr></tbody></table>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
  <tbody>
  <tr>
    <td class="l"><img alt="" src="Tutorial_46_files/blank1.gif" height="28" width="28"></td>
      <td class="back3" valign="top" width="100%">如果你想知道更多的关于多重采样的信息,请访问下面的链接:
<p><a href="http://developer.nvidia.com/attach/3464">GDC2002 -- OpenGL Multisample</a><br>
        <a href="http://developer.nvidia.com/attach/2064">OpenGL Pixel Formats 
        and Multisample Antialiasing</a> </p>
        <p>下面我们来介绍如何使用多重采样,不向其他的扩展,我们在使用多重采样时,必须在窗口创建时告诉它使用多重采样,典型的步骤如下:<br>
          1、创建一个窗口<br>
          2、查询是否支持多重采样<br>
          3、如果支持删除当前的窗口,使用支持多重采样的格式创建窗口<br>
          4、如果我们想使用多重采样,仅仅启用它既可。</p>
        <p>了解了上面,我们从头说明如何使用多重采样,并介绍ARB_Multisample的实现方法:</p>
        </td>
    <td class="r"><img alt="" src="Tutorial_46_files/blank1.gif" height="28" width="28"></td></tr></tbody></table>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
  <tbody>
  <tr>
    <td class="bl"><img alt="" src="Tutorial_46_files/blank1.gif" height="28" width="28"></td>
    <td class="bc" width="100%"><img alt="" src="Tutorial_46_files/blank1.gif" height="28" width="28"></td>
    <td class="br"><img alt="" src="Tutorial_46_files/blank1.gif" height="28" width="28"></td></tr></tbody></table>
<pre>#include &lt;windows.h&gt;<br>#include &lt;gl.h&gt;<br>#include &lt;glu.h&gt;<br>#include "arb_multisample.h"</pre>
<p></p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
  <tbody>
  <tr>
    <td class="tl"><img alt="" src="Tutorial_46_files/blank1.gif" height="28" width="28"></td>
    <td class="tc" width="100%"><img alt="" src="Tutorial_46_files/blank1.gif" height="28" width="100%"></td>
    <td class="tr"><img alt="" src="Tutorial_46_files/blank1.gif" height="28" width="28"></td></tr></tbody></table>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
  <tbody>
  <tr>
    <td class="l"><img alt="" src="Tutorial_46_files/blank1.gif" height="28" width="28"></td>
      <td class="back3" valign="top" width="100%">下面两行定义我需要使用的像素格式</td>
    <td class="r"><img alt="" src="Tutorial_46_files/blank1.gif" height="28" width="28"></td></tr></tbody></table>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
  <tbody>
  <tr>
    <td class="bl"><img alt="" src="Tutorial_46_files/blank1.gif" height="28" width="28"></td>
    <td class="bc" width="100%"><img alt="" src="Tutorial_46_files/blank1.gif" height="28" width="28"></td>
    <td class="br"><img alt="" src="Tutorial_46_files/blank1.gif" height="28" width="28"></td></tr></tbody></table>
<pre><span class="theme">// 声明我们将要使用</span><br>#define WGL_SAMPLE_BUFFERS_ARB	0x2041<br>#define WGL_SAMPLES_ARB		0x2042</pre>
<p>bool arbMultisampleSupported = false;<br>
  int arbMultisampleFormat = 0;</p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
  <tbody>
  <tr>
    <td class="tl"><img alt="" src="Tutorial_46_files/blank1.gif" height="28" width="28"></td>
    <td class="tc" width="100%"><img alt="" src="Tutorial_46_files/blank1.gif" height="28" width="100%"></td>
    <td class="tr"><img alt="" src="Tutorial_46_files/blank1.gif" height="28" width="28"></td></tr></tbody></table>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
  <tbody>
  <tr>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -