青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

Shuffy

不斷的學習,不斷的思考,才能不斷的進步.Let's do better together!
posts - 102, comments - 43, trackbacks - 0, articles - 19
Blending and Transparency

Blending in OpenGL provides pixel-level control of RGBA color storage in the color buffer. To enable blending we must first call glEnable(GL_BLEND). We have to set up the blending function glBlendFunc with two arguments: the source and the destination colors. By default these are GL_ONE and GL_ZERO respectively, which is equivalent to glDisable(GL_BLEND). The blend functions are applied to the source color set by glColor and destination color in the color buffer. The results of the blending functions are added together to generate the new color value which is put onscreen.

Transparency is perhaps the most typical use of blending. In order to produce transparency we should set up the blending function as follows - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA). This combination takes the source color, scales it based on the alpha component and then adds the destination pixel color scaled by 1 minus the alpha value. It basically takes a fraction of the current drawing color and overlays it on the pixel on the screen. The alpha component can be from 0 (completely transparent) to 1 (completely opaque).

Anti-Aliasing

You might have noticed in some of your OpenGL pictures that lines, especially nearly horizontal or nearly vertical ones, appear jagged. These jaggies appear because the ideal line is approximated by a series of pixels that must lie on the pixel grid. The jaggedness is called aliasing. Antialiasing can be enabled by calling the function - glEnable(GL_POLYGON_SMOOTH) for polygons.

Fog

An entire image can be made to appear more natural by adding fog, which makes objects fade into the distance. Fog is a general term that describes similar forms of atmospheric effects; it can be used to simulate haze, mist, smoke, or pollution. Fog is essential in visual-simulation applications, where limited visibility needs to be approximated.

When fog is enabled, objects that are farther from the viewpoint begin to fade into the fog color. You can control the density of the fog, which determines the rate at which objects fade as the distance increases, as well as the fog's color. Since fog is applied after matrix transformations, lighting, and texturing are performed, it affects transformed, lit, and textured objects.

Using fog is easy. Enable it by passing GL_FOG to glEnable(), and you choose the color and the equation that controls the density with glFog*().

1,CCY457OpenGLView類中加入下列布爾變量,分別代表是否開啟混合,霧和反鋸齒效果。

Code

并在構造函數中對其初始化:

CCY457OpenGLView::CCY457OpenGLView()
{
    m_xRot 
= 0.0f;
    m_yRot 
= 0.0f;
    m_texWrap 
= GL_CLAMP;
    m_texMode 
= GL_DECAL;
    m_texFilter 
= GL_NEAREST;
    m_blend 
= FALSE;
    m_fog   
= FALSE;
    m_antialias 
= FALSE;
}

2,加入控制上述三種效果的菜單項及其事件處理函數

void COpenGLView::OnEffectsBlending() 
{
    
// TODO: Add your command handler code here
    m_blend = !m_blend;
    
if(m_blend)
        glEnable(GL_BLEND);
    
else
        glDisable(GL_BLEND);
    InvalidateRect(NULL,FALSE);
}
void COpenGLView::OnUpdateEffectsBlending(CCmdUI* pCmdUI) 
{
    
// TODO: Add your command update UI handler code here
    pCmdUI->SetCheck(m_blend);
}
void COpenGLView::OnEffectsAntialiasing() 
{
    
// TODO: Add your command handler code here
    m_antialias = !m_antialias;
    
if(m_antialias)
        glEnable(GL_POLYGON_SMOOTH);
    
else
        glDisable(GL_POLYGON_SMOOTH);
    InvalidateRect(NULL,FALSE);
}
void COpenGLView::OnUpdateEffectsAntialiasing(CCmdUI* pCmdUI) 
{
    
// TODO: Add your command update UI handler code here
    pCmdUI->SetCheck(m_antialias);    
}
void COpenGLView::OnEffectsFog() 
{
    
// TODO: Add your command handler code here
    m_fog = !m_fog;
    
if(m_fog)
        glEnable(GL_FOG);
    
else
        glDisable(GL_FOG);
    InvalidateRect(NULL,FALSE);
}
void COpenGLView::OnUpdateEffectsFog(CCmdUI* pCmdUI) 
{
    
// TODO: Add your command update UI handler code here
    pCmdUI->SetCheck(m_fog);
}

3,在InitializeOpenGL函數中對霧效果進行設置。

BOOL CCY457OpenGLView::InitializeOpenGL()
{
    
//Get a DC for the Client Area
    m_pDC = new CClientDC(this);
    
//Failure to Get DC
    if(m_pDC == NULL)
    {
        MessageBox(
"Error Obtaining DC");
        
return FALSE;
    }
    
//Failure to set the pixel format
    if(!SetupPixelFormat())
    {
        
return FALSE;
    }
    
//Create Rendering Context
    m_hRC = ::wglCreateContext (m_pDC->GetSafeHdc ());
    
//Failure to Create Rendering Context
    if(m_hRC == 0)
    {
        MessageBox(
"Error Creating RC");
        
return FALSE;
    }
    
//Make the RC Current
    if(::wglMakeCurrent (m_pDC->GetSafeHdc (), m_hRC)==FALSE)
    {
        MessageBox(
"Error making RC Current");
        
return FALSE;
    }
    
//Specify Black as the clear color
    ::glClearColor(0.0f,0.0f,0.0f,0.0f);
    
//Specify the back of the buffer as clear depth
    ::glClearDepth(1.0f);
    
//Enable Depth Testing
    ::glEnable(GL_DEPTH_TEST);
    ::glShadeModel(GL_SMOOTH);
    
//設置霧
    ::glFogi(GL_FOG_MODE, GL_EXP);
    GLfloat fog_color[
4= {0.2f,0.2f,0.2f,0.0f};
    ::glFogfv(GL_FOG_COLOR, fog_color);
    ::glFogf(GL_FOG_DENSITY, 
0.25);
    
//加載紋理
    LoadGLTextures();
    
//設置燈光
    SetupLighting();
    ::glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    
return TRUE;
}

作者:洞庭散人

出處:http://phinecos.cnblogs.com/    

本文版權歸作者和博客園共有,歡迎轉載,但未經作者同意必須保留此段聲明,且在文章頁面明顯位置給出原文連接,否則保留追究法律責任的權利。
原文鏈接:http://www.cnblogs.com/phinecos/archive/2008/11/06/1327948.html
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            久久久久久一区二区| 羞羞答答国产精品www一本| 亚洲一区二区三区免费视频| 亚洲人成人99网站| 欧美成人a视频| 亚洲人成人一区二区三区| 亚洲电影毛片| 欧美日韩一级片在线观看| 久久久久一区二区三区| 18成人免费观看视频| 欧美激情1区2区| 午夜视频在线观看一区二区| 国产亚洲欧美一区| 欧美1区2区3区| 99在线精品观看| 国产精品女人毛片| 久久深夜福利| 亚洲精品乱码久久久久久| 亚洲你懂的在线视频| 国产精品久久久久婷婷| 免费在线亚洲| 欧美一区精品| 亚洲视频精品在线| 亚洲激情网站| 久久五月天婷婷| 久久久精品tv| 欧美一级网站| 久久精品免费| 国产精品久久一卡二卡| 欧美激情综合| 国内精品国语自产拍在线观看| 美国成人直播| 欧美日韩在线不卡| 美女免费视频一区| 1000部精品久久久久久久久| 欧美高清视频在线观看| av成人免费在线观看| 欧美一区二区免费观在线| 国产亚洲人成a一在线v站| 久久国产精品色婷婷| 欧美一二三视频| 亚洲国产精品成人精品| 欧美一区影院| 一本色道久久综合亚洲精品不| 国产免费成人| 欧美日韩免费观看一区| 麻豆精品在线播放| 久久精品在线视频| 久久gogo国模裸体人体| 亚洲激情黄色| 亚洲片在线资源| 久久久久久伊人| 老妇喷水一区二区三区| 久久精品视频va| 久久国产精品毛片| 亚洲午夜小视频| 欧美一区二区日韩一区二区| 亚洲图片你懂的| 欧美一级大片在线观看| 久久国产精品久久久久久| 亚洲图片激情小说| 欧美一二三区在线观看| 久久精品视频在线| 女人色偷偷aa久久天堂| 91久久国产精品91久久性色| 亚洲黄色成人网| 亚洲欧美综合精品久久成人| 亚洲欧美日韩在线观看a三区| 亚洲免费视频中文字幕| 麻豆精品一区二区av白丝在线| 老司机午夜精品视频| 小辣椒精品导航| 亚洲欧美视频在线| 久久久国产精彩视频美女艺术照福利| 欧美在线看片| 国产精品日韩欧美一区二区| 欧美日韩在线观看视频| 亚洲精品社区| 久久夜色精品国产亚洲aⅴ | 麻豆av福利av久久av| 欧美成人精品激情在线观看| 日韩一区二区高清| 久久精品成人一区二区三区蜜臀 | 久久综合久色欧美综合狠狠 | 性亚洲最疯狂xxxx高清| 国产在线视频欧美| 亚洲激情综合| 国产精品青草综合久久久久99| 欧美成人精品影院| 欧美电影免费观看| 亚洲欧美三级伦理| 午夜精品亚洲| 永久域名在线精品| 国产精品sss| 欧美一区二区福利在线| 久久福利毛片| 午夜精品亚洲一区二区三区嫩草| 香蕉久久夜色| 一本色道久久综合狠狠躁篇怎么玩| 性欧美1819性猛交| 亚洲三级毛片| 久久精品视频在线观看| 亚洲美女免费精品视频在线观看| 免费成人av在线| 一区二区三区黄色| 欧美一区二区三区免费在线看| 亚洲激情午夜| 亚洲欧美日韩系列| 亚洲午夜91| 国产精品福利网站| 亚洲午夜精品久久| 亚洲综合色网站| 国产精品久久久久91| 亚洲国产精品一区制服丝袜| 亚洲第一偷拍| 久久av一区二区| 久久久久免费视频| 红桃视频成人| 欧美精品久久一区二区| 亚洲国产日韩精品| 亚洲欧美视频一区| 国产日韩欧美中文在线播放| 欧美在现视频| 久久久久久色| 亚洲国产精品尤物yw在线观看 | 老司机免费视频一区二区三区 | 国产精品专区一| 日韩视频免费在线| 久久久久久尹人网香蕉| 91久久久久久| 欧美日韩一区二区在线视频| 亚洲少妇中出一区| 欧美成人69av| 亚洲一区国产一区| 欧美日韩1区| 亚洲欧美国产制服动漫| 欧美777四色影视在线| 亚洲国产成人高清精品| 欧美欧美天天天天操| 销魂美女一区二区三区视频在线| 欧美大片免费观看| 亚洲欧美日韩天堂一区二区| 亚洲激情社区| 国产一区二区| 欧美日韩理论| 久久精品盗摄| 在线一区日本视频| 亚洲国产精品99久久久久久久久| 午夜视频一区| 久久se精品一区精品二区| 亚洲欧洲一区二区在线播放| 欧美精品日韩一区| 鲁大师影院一区二区三区| 国产亚洲精品v| 欧美三级午夜理伦三级中视频| 久久久噜噜噜久久中文字免 | 国产精品男女猛烈高潮激情| 一本色道久久综合精品竹菊| 久久深夜福利| 久久夜色精品一区| 久久av一区| 欧美在线免费播放| 久久免费视频网| 噜噜噜久久亚洲精品国产品小说| 久久美女性网| 亚洲高清在线观看一区| 欧美激情亚洲| 久久xxxx| 美国成人毛片| 欧美一站二站| 久久夜色精品国产亚洲aⅴ| 中文在线资源观看视频网站免费不卡| 久久亚洲私人国产精品va| 久久久久久亚洲精品中文字幕 | 亚洲精品日韩在线| 99国产成+人+综合+亚洲欧美| 黑人极品videos精品欧美裸| 很黄很黄激情成人| 亚洲黄网站黄| 亚洲影院污污.| 欧美大片网址| 久久久久久国产精品mv| 国产精品成人免费视频| 国产精品久久久亚洲一区| 亚洲电影免费观看高清完整版| 亚洲国产美女| 久久久噜噜噜久久中文字幕色伊伊 | 欧美1区免费| 亚洲老板91色精品久久| 欧美一区二区精品在线| 91久久线看在观草草青青| 欧美一区二区三区四区在线| 欧美三级黄美女| 怡红院精品视频在线观看极品| 性做久久久久久久免费看| aⅴ色国产欧美| 欧美人与性禽动交情品 | 亚洲一级片在线观看| 欧美成年人网站| 老司机精品视频一区二区三区|