NeHe学习笔记

NeHe lesson 08:

OpenGL中的混色
在OpenGL中实现混色的步骤类似于我们以前提到的OpenGL过程。接着设置公式,并在绘制透明对象时关闭写深度缓存。因为我们想在半透明的图形背后绘制 对象。这不是正确的混色方法,但绝大多数时候这种做法在简单的项目中都工作的很好。
Rui Martins 的补充: 正确的混色过程应该是先绘制全部的场景之后再绘制透明的图形。并且要按照与深度缓存相反的次序来绘制(先画最远的物体)。
考虑对两个多边形(1和2)进行alpha混合,不同的绘制次序会得到不同的结果。(这里假定多边形1离观察者最近,那么正确的过程应该先画多边形2,再画多边形1。正如您再现实中所见到的那样,从这两个<透明的>多边形背后照射来的光线总是先穿过多边形2,再穿过多边形1,最后才到达观察者的眼睛。)
在深度缓存启用时,您应该将透明图形按照深度进行排序,并在全部场景绘制完毕之后再绘制这些透明物体。否则您将得到不正确的结果。我知道某些时候这样做是很令人痛苦的,但这是正确的方法。

NeHe lesson 12:

glEnable(GL_COLOR_MATERIAL); // 使用颜色材质
GL_COLOR_MATERIAL使我们可以用颜色来贴纹理。如果没有这行代码,纹理将始终保持原来的颜色,glColor3f(r,g,b)就没有用了。总之这行代码是很有用的 

NeHe SDK v1.10 This is a small Software Development Kit which covers a number of the tutorials written by Jeff Molofee(NeHe) into a fairly unified framework that should allow the construction of simple graphical games. There are nine example executables(in the bin directory) showing off the capabilities of the SDK. They are: Example 1: A simple rotating box and pyramid Example 2: Text using OpenGL routines Example 3: 3d Text using OpenGL routines Example 4: Rotating box and pyramid showing frame counter Example 5: Particle engine and billboard demonstration Example 6: Rotating cube using multitexturing Example 7: MD2 animation and milkshape object rendering demo Example 8: Video texturing Example 9: Built in shapes and display list demonstration Example 10: Simple fog demonstration Example 11: Environment mapping demonstration Example 12: Scissor test and 2d demos Required specification: IBM compatible PC Pentium 300 (although it may work with less) with 64MB RAM OpenGL compatible graphics card with latest drivers. Note: Some older cards, such as Voodoos and the early ATIs do not have drivers which appear to be completely compatible. Use these at your own risk. Any card problems reported are in bugs.txt Microsoft Visual Studio 6 for recompilation and development, although there should be no reason why it couldn't be compiled on Borland with a few changes. MinGW gcc however has no support for IPicture at the time of writing, so porting it might be a little more complex. License: If you use this software you agree to be bound by the licence in the license.txt file. Known Bugs: See bugs.txt Acknowledgments: See thanks.txt Development with this SDK: The simplest way to get to grips with this SDK is to read through the example files, then throught the library header files.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值