opengl超级宝典笔记——Using Opengl

<h2>第二章 使用OpenGL</h2> <h3>(一)OpenGl 的工作原理</h3> <p>OpenGL是过程式的而非描述性的图形API。开发人员只须规定必要的步骤去实现显示的效果。这些步骤包含了许多OpenGL的命令。这些命令用于绘制许多的几何图元,例如点,线,多边形。OpenGL支持光照和阴影,纹理映射,混合,透明效果,动画,还有许多特殊的效果。</p> <h3>(二)通用实现<sub></sub></h3> <p>通用实现是指软件实现,软件实现的好处是跨硬件。但是性能不佳,没有硬件加速。</p> <p>软件通用实现的OpenGL API所处的位置如下图:</p> <p><a href="http://static.oschina.net/uploads/img/201309/02231053_ukqK.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://static.oschina.net/uploads/img/201309/02231053_2vLk.png" width="510" height="213" /></a></p> <p>其首先用软件实现去光栅化绘制3D图像,然后传给GDI,GDI负责与显示设备交互显示图像。</p> <h3>(三)硬件实现</h3> <p>OpenGL API调用直接传给硬件驱动。硬件驱动不会把图形传给Windows GDI进行显示。而是直接与图形显示设备交互。</p> <p><a href="http://static.oschina.net/uploads/img/201309/02231054_HdbX.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://static.oschina.net/uploads/img/201309/02231056_ol8a.png" width="551" height="214" /></a></p> <h3>(四)图形管线</h3> <p>管线是用于描述一系列的处理流程。下图是一个简化版本的图形管线</p> <p><a href="http://static.oschina.net/uploads/img/201309/02231056_Bukq.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://static.oschina.net/uploads/img/201309/02231056_CBnZ.png" width="530" height="148" /></a></p> <p>一个应用程序调用了许多OpenGL的API,这些命令被传送到Commond Buffer</p> <p>这个buffer填充着许多命令,顶点数据,纹理数据等等,当缓冲区的数据被刷新时,命令和数据就被传递给管线的下一阶段。</p> <p>顶点数据首先会进行变换和光照。这个阶段完成之后,数据被传输到管线的光栅化部分。最后图像被放入到帧缓冲区。</p> <p>早期的OpenGL硬件加速器只是对光栅化阶段进行了加速。然而现在的硬件加速器都提供了变换和光照阶段。</p>

转载于:https://my.oschina.net/sweetdark/blog/158727

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值