Transparency
来源:互联网 发布:淘宝6s特价1380能买吗 编辑:程序博客网 时间:2024/05/22 08:22
Introduction
In the last tutorial, we spoke about how to work with color blending.
We found out that this can be extremely useful for transparency. This tutorial will show you how to create a transparent 3D object.
The tutorial is modified from tutorial 17.
Contents of main.cpp :
Our first step is to enable blending in our init function.
glEnable(GL_BLEND);
The blending function we are using is the (GL_SRC_ALPHA, GL_ONE) function.
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
We want all polygons to be drawn and so we therefore disable depth testing. Having depth testing enabled will cause the polygons at the back to not display.
glDisable(GL_DEPTH_TEST);
Our menu function is modified to process a Toggle Blending menu option. Notice that we also enable and disabledepth testing appropriately. This ensures that all sides are rendered.
case 3 :if (glIsEnabled(GL_BLEND)){glDisable(GL_BLEND);glEnable(GL_DEPTH_TEST);}else{glEnable(GL_BLEND);glDisable(GL_DEPTH_TEST);}break;
This can create some good effects. I have left the code to enable and disable lighting as was done in tutorial 17. The difference when lighting is disabled is shown below. Here the colors are multiplied by the texture map.
Lighting EnabledLighting DisabledPlease let me know of any comments you may have : Contact Me
GLUT|ES Source Files : UG Source Files :- Transparency
- Transparency 技术总结
- 政务透明 administrative transparency
- set the div transparency
- OGRE中实现Transparency
- CSS Image Opacity / Transparency
- Color and Transparency
- OGRE中实现Transparency
- Alpha Colours (transparency) 例子
- CEdit & CStatic Transparency Control
- ValueError: bad transparency mask
- Cg Programming/Unity/Transparency
- 证书透明度Certificate Transparency
- 证书透明度Certificate Transparency
- alpha is transparency
- Order Independent Transparency
- bad transparency mask. 解决办法
- TAOUP设计原则-透明性Transparency
- jmap功能!
- 芯钰科运动控制卡-VC快速搭建软件平台(编程示范)
- 点击UItableViewCell上的cell进入另一个页面
- 2014/3/23 枚举和泛型
- Notes 1 of More Effective C++ —— Basics
- Transparency
- hdu 4150 Powerful Incantation
- UNIX Network Programming笔记之第六章上篇
- freemark标签使用
- php判断客户端是手机还是电脑访问网站代码
- java中的HashMap
- 网站怎么做才能够真正的留住用户?
- redis学习入门初章
- java反射机制基础详解