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

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久久网站| 亚洲欧洲av一区二区| 亚洲精品乱码久久久久久日本蜜臀 | 亚洲美女av黄| 蜜桃久久精品一区二区| 亚洲欧美视频在线观看视频| 欧美网站在线| 亚洲永久精品国产| 欧美成年人视频网站| 午夜久久久久| 亚洲精品欧美日韩| 欧美国产精品人人做人人爱| 亚洲日韩视频| 亚洲激情黄色| 欧美日韩ab| 亚洲你懂的在线视频| 亚洲一区二区日本| 国产色视频一区| 久久深夜福利| 欧美99在线视频观看| 99re在线精品| 99riav国产精品| 国产精品丝袜久久久久久app| 欧美一级在线亚洲天堂| 性色av一区二区怡红| 亚洲高清一区二| 亚洲精品视频啊美女在线直播| 欧美午夜精品久久久久免费视| 性欧美xxxx大乳国产app| 久久国产精品黑丝| 亚洲精选成人| 亚洲一区欧美激情| 黄色成人免费观看| 乱码第一页成人| 欧美国产成人精品| 亚洲永久在线| 欧美一区=区| 狠狠色2019综合网| 亚洲精品视频在线播放| 国产欧美欧洲在线观看| 欧美成人高清视频| 国产精品美女久久久久久2018 | 黄色亚洲在线| 亚洲精品一区二区三| 国产午夜精品久久久久久免费视| 欧美成人中文字幕| 一二三区精品| 在线观看欧美视频| 亚洲综合视频1区| 亚洲日本中文字幕| 久久午夜av| 欧美午夜精品久久久| 欧美sm视频| 国产亚洲精品资源在线26u| 亚洲第一区色| 国产亚洲欧美aaaa| 日韩视频欧美视频| 亚洲电影毛片| 欧美制服丝袜第一页| 中文有码久久| 久久免费国产| 国产欧美日韩激情| 久久综合久色欧美综合狠狠 | 欧美激情免费观看| 国产日韩精品在线播放| 亚洲成人中文| 久久男人资源视频| 国产精品久99| 亚洲乱码国产乱码精品精可以看 | 久久久久久亚洲精品杨幂换脸| 欧美视频在线观看一区二区| 欧美一区日韩一区| 国产精品国产三级国产aⅴ无密码| 久久精品视频在线免费观看| 欧美性做爰猛烈叫床潮| 亚洲免费大片| av成人动漫| 欧美韩日视频| 亚洲精品永久免费精品| 最新中文字幕亚洲| 欧美成年人视频网站欧美| 欧美成人午夜免费视在线看片| 激情久久综艺| 久久综合九色欧美综合狠狠| 久久一区二区三区av| 亚洲大胆美女视频| 免费欧美在线视频| 亚洲欧洲一区二区三区在线观看| 国产精品一区二区a| 亚洲欧洲精品一区二区三区不卡| 日韩一区二区精品| 欧美视频福利| 亚洲欧美色婷婷| 久久午夜精品| 亚洲精品一区二区三| 欧美日韩精品免费观看视一区二区 | 国产精品婷婷| 午夜久久影院| 欧美成人精品不卡视频在线观看| 国产欧美日本| 亚洲欧美经典视频| 久久免费国产| 亚洲精选视频在线| 国产精品久久九九| 欧美一区二区三区视频在线| 久久三级福利| 99视频一区二区| 国产免费亚洲高清| 久久资源在线| 中文精品99久久国产香蕉| 久久精品免费播放| 亚洲精品欧美在线| 欧美丝袜第一区| 久久免费偷拍视频| 亚洲一区成人| 国产亚洲精品7777| 欧美成年视频| 亚洲一区二区三区在线播放| 欧美在线网站| 欧美插天视频在线播放| 亚洲综合视频网| 亚洲高清视频在线观看| 欧美夜福利tv在线| 日韩午夜电影| 国产综合色产在线精品| 欧美喷水视频| 久久久夜夜夜| 亚洲一区二区免费视频| 亚洲精品国产精品国产自| 欧美专区中文字幕| 99这里有精品| 亚洲韩国青草视频| 国产精品亚洲综合一区在线观看| 校园春色综合网| 99精品视频一区二区三区| 欧美成人精品在线视频| 欧美一级久久| 亚洲香蕉伊综合在人在线视看| 亚洲黑丝在线| 在线看视频不卡| 黄色亚洲网站| 国产欧美精品一区二区色综合| 欧美精品一区二区三区在线看午夜 | 国产精品久久久久久久久久免费看 | 男同欧美伦乱| 久久手机精品视频| 欧美亚洲免费高清在线观看| 99视频精品全国免费| 亚洲人成欧美中文字幕| 欧美成人日本| 欧美不卡一卡二卡免费版| 久久亚洲精品一区| 久久gogo国模啪啪人体图| 亚洲无线一线二线三线区别av| 亚洲人成绝费网站色www| 亚洲电影免费在线| 在线看成人片| 亚洲第一页自拍| ●精品国产综合乱码久久久久| 国产婷婷97碰碰久久人人蜜臀| 国产精品视频导航| 国产毛片久久| 欧美日本乱大交xxxxx| 欧美在线综合| 欧美一区二视频| 久久久天天操| 亚洲国产精品尤物yw在线观看 | 久久亚洲不卡| 欧美国产日韩xxxxx| 亚洲精品精选| 亚洲免费中文字幕| 久久一二三国产| 欧美日韩精品一区二区三区四区| 国产精品久久久一区二区三区| 国产午夜精品久久| 亚洲精品日产精品乱码不卡| 国产精品99久久久久久人| 久久国产综合精品| 亚洲高清视频在线| 亚洲欧美日韩网| 欧美mv日韩mv国产网站app| 欧美三级视频在线| 影音先锋亚洲视频| 中文欧美字幕免费| 蜜桃久久精品一区二区| 亚洲深夜福利在线| 欧美成人国产一区二区| 国产精品视频免费在线观看| 亚洲高清影视| 欧美在线免费看| 亚洲日本欧美天堂| 久久裸体艺术| 国产精品久久久久久模特| 亚洲精品中文字幕有码专区| 欧美一区二区三区四区在线观看地址| 欧美肥婆在线|