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

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

并在構造函數(shù)中對其初始化:

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,加入控制上述三種效果的菜單項及其事件處理函數(shù)

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函數(shù)中對霧效果進行設置。

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/    

本文版權歸作者和博客園共有,歡迎轉載,但未經(jīng)作者同意必須保留此段聲明,且在文章頁面明顯位置給出原文連接,否則保留追究法律責任的權利。
原文鏈接: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>
            99精品国产在热久久婷婷| 欧美国产先锋| 欧美成人综合一区| 巨胸喷奶水www久久久免费动漫| 亚洲自拍偷拍网址| 欧美一区二区三区四区在线 | 欧美亚洲综合久久| 校园激情久久| 久久综合福利| 亚洲国产精品一区二区三区| 牛夜精品久久久久久久99黑人| 免费亚洲电影在线| 亚洲人成在线观看网站高清| 99re6这里只有精品视频在线观看| 亚洲精品视频在线| 亚洲一区二区三区国产| 久久精彩视频| 欧美日韩国产999| 国产欧美日韩在线观看| 樱桃成人精品视频在线播放| 亚洲精品乱码视频| 欧美在线黄色| 欧美激情亚洲激情| 亚洲一区二区三区在线看 | 欧美一区免费| 欧美国产日韩在线| 国产欧美精品日韩| 91久久久精品| 欧美一区二区三区啪啪| 欧美激情视频免费观看| 在线一区二区三区四区| 久久露脸国产精品| 国产精品高潮呻吟| 亚洲七七久久综合桃花剧情介绍| 一本久道久久久| 久久久人人人| av不卡在线看| 欧美精品亚洲一区二区在线播放| 国产一区二区三区四区| 亚洲午夜性刺激影院| 久久综合九色综合欧美就去吻| 亚洲作爱视频| 欧美好吊妞视频| 在线观看日韩www视频免费| 亚洲欧美综合一区| 99热这里只有精品8| 美女日韩在线中文字幕| 国产精品视频福利| 老司机久久99久久精品播放免费 | 亚洲国产一区二区三区青草影视| 亚洲欧美日韩一区二区三区在线观看| 欧美第一黄色网| 亚洲国产精品一区二区第一页 | 久久资源av| 国产毛片一区二区| 亚洲与欧洲av电影| 亚洲精品在线三区| 欧美经典一区二区三区| 亚洲精品视频在线| 亚洲国产专区校园欧美| 欧美国产日韩在线观看| 精品99一区二区| 久久婷婷蜜乳一本欲蜜臀| 亚洲综合精品| 国产日韩欧美在线| 久久久99精品免费观看不卡| 亚洲欧美怡红院| 国产亚洲a∨片在线观看| 久久国产精品毛片| 久久国产精品网站| 亚洲激情偷拍| 日韩一级大片| 国产精品欧美日韩一区二区| 欧美影院成人| 久久精品二区| 亚洲精品日韩一| 在线一区二区三区四区五区| 国产农村妇女精品| 久久综合狠狠综合久久综青草| 久久免费高清视频| 99在线精品视频在线观看| 亚洲午夜av| 国产永久精品大片wwwapp| 欧美大片免费观看在线观看网站推荐| 欧美成人网在线| 欧美在线视频不卡| 免费看精品久久片| 亚洲午夜激情| 久久国产欧美日韩精品| 亚洲精品视频二区| 午夜精品久久久久久久蜜桃app| 国产一区观看| 亚洲高清久久久| 欧美午夜不卡视频| 久久久人成影片一区二区三区| 老司机精品久久| 日韩小视频在线观看| 99精品欧美| 尤物yw午夜国产精品视频明星| 美女视频一区免费观看| 欧美jjzz| 亚洲男人的天堂在线观看| 亚洲欧美亚洲| 欧美大片免费观看| 亚洲尤物在线| 久久精品国产亚洲一区二区| 亚洲国产精品久久人人爱蜜臀 | 欧美一区二区三区在线播放| 亚洲综合日韩| 猫咪成人在线观看| 宅男精品导航| 久久精品中文字幕一区| 这里只有精品视频| 亚洲欧美成人网| 国产视频一区在线观看一区免费| 亚洲欧洲一区二区三区在线观看| 国产精品久久久久一区二区三区共 | 亚洲电影在线免费观看| 亚洲欧美精品| 91久久线看在观草草青青| 99精品视频免费| 狠狠狠色丁香婷婷综合久久五月| 91久久夜色精品国产九色| 国产日本欧美一区二区| 亚洲精品一区二区三区99| 亚洲人精品午夜在线观看| 亚洲欧美一区在线| 亚洲视频一区二区| 男人的天堂成人在线| 欧美亚洲视频在线看网址| 欧美成人免费全部观看天天性色| 欧美大片网址| 韩国免费一区| 亚洲女人小视频在线观看| 99在线精品免费视频九九视| 久久精品免费观看| 欧美一级淫片aaaaaaa视频| 国产精品入口尤物| 一区二区三区高清视频在线观看| 亚洲国产精品成人一区二区| 欧美在线免费| 校园激情久久| 国产精品免费小视频| 亚洲第一区在线| 亚洲国产三级网| 久久精品国产99国产精品澳门| 亚洲一级在线| 欧美日韩岛国| 亚洲精品视频免费| 欧美在线黄色| 国产精品一区2区| 一区二区三区精品视频在线观看| 亚洲美女视频| 欧美精品一区二区三区在线看午夜| 牛牛国产精品| 亚洲狠狠婷婷| 老司机精品久久| 欧美激情国产日韩| 最新国产精品拍自在线播放| 久久一区二区精品| 欧美14一18处毛片| 国产精品一级二级三级| 久久五月天婷婷| 欧美不卡在线| 美日韩在线观看| 美女精品国产| 亚洲黄网站在线观看| 欧美香蕉视频| 性刺激综合网| 久久天天狠狠| 亚洲激情精品| 欧美午夜精品伦理| 在线视频精品一区| 影音先锋中文字幕一区| 欧美成人午夜剧场免费观看| 亚洲激情在线观看| 亚洲一区精彩视频| 国产女人18毛片水18精品| 一区二区av| 久久久夜夜夜| 国产欧美日韩精品在线| 久久网站免费| av成人天堂| 久久视频一区| 午夜精品久久久久久久久| 精品成人国产| 欧美一区二区在线免费播放| 欧美成人午夜影院| 亚洲视频中文| 亚洲日本欧美日韩高观看| 欧美婷婷久久| 久久久不卡网国产精品一区| 亚洲精品色图| 久久亚洲一区二区三区四区| 亚洲女同同性videoxma| 今天的高清视频免费播放成人| 欧美日韩 国产精品| 久久国产欧美精品| 中文无字幕一区二区三区| 日韩视频在线你懂得|