• <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>

            逛奔的蝸牛

            我不聰明,但我會很努力

               ::  :: 新隨筆 ::  ::  :: 管理 ::
            Accumulation Buffer(非時實繪制情況下, 做全局反鋸齒的效果最好, 運動模糊):
            Color Buffer, Depth Buffer, Stencil Buffer, Accumulation Buffer, (Double Buffer, ^_^)

            glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH | GLUT_ACCUM); 

            The accumulation buffer is an extended-range color buffer. Images are not rendered into it. Rather, images rendered into one of the color buffers are added to the contents of the accumulation buffer after rendering. Effects such as antialiasing (of points, lines, and polygons), motion blur, and depth of field can be created by accumulating images generated with different transformation matrices.

            This buffer allows you to render to the color buffer, and then instead of displaying the results in the window, copy the contents of the color buffer to the accumulation buffer. Several supported copy operations allow you to repeatedly blend, in different ways, the color buffer contents with the accumulated contents in the accumulation buffer (thus its name). When you have finished accumulating an image, you can then copy the accumulation buffer back to the color buffer and display the results with a buffer swap. 
            也是很簡單的幾步, 但是要把同一個物體多畫幾次, 累積出motion blur效果, 會占用很多內存與資源.

            Because of the large amount of memory that must be copied and processed for accumulation buffer operations, few real-time applications make use of this capability. For non-real-time rendering, OpenGL can produce some astonishing effects that you might not expect from a real-time API. For example, you can render a scene multiple times and move the point of view around by a fraction of a pixel each time. Accumulating these multiple rendering passes blurs the sharp edges and can produce an entire scene fully antialiased with a quality that surpasses anything that can be done with multisampling. You can also use this blurring effect to blur the background or foreground of an image and then render the object of focus clearly afterward, simulating some depth-of-field camera effects.

            操作: 
            In our sample program MOTIONBLUR, we will demonstrate yet another use of the accumulation buffer to create what appears to be a motion blur effect. A moving sphere is drawn repeatedly in different positions. Each time it is drawn, it is accumulated to the accumulation buffer, with a smaller weight on subsequent passes. The result is a brighter red sphere with a ghostlike image of itself following along behind.
            Shows the DrawGeometry function, which draws all the geometry of the scene. 
            The RenderScene function then repeatedly calls this function and accumulates the results into the accumulation buffer. When that process is finished, the lines 
            glAccum(GL_RETURN, 1.0f); 
            glutSwapBuffers(); 
            copy the accumulation buffer back to the color buffer and perform the buffer swap. 
            Using the Accumulation Buffer for Motion Blur: 

            ///////////////////////////////////////////////////////////// 
            // Draw the ground and the revolving sphere 
            void DrawGeometry(void) {
                // Clear the window with current clearing color 
                glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
                glPushMatrix();
                    DrawGround();
                    // Place the moving sphere 
                    glColor3f(1.0f, 0.0f, 0.0f);
                    glTranslatef(0.0f, 0.5f, -3.5f);
                    glRotatef(-(yRot * 2.0f), 0.0f, 1.0f, 0.0f);
                    glTranslatef(1.0f, 0.0f, 0.0f);
                    glutSolidSphere(0.1f, 17, 9);
                glPopMatrix();
            }

            /////////////////////////////////////////////////////////////////////// 
            // Called to draw scene. The world is drawn multiple times with each 
            // frame blended with the last. The current rotation is advanced each 
            // time to create the illusion of motion blur. 
            void RenderScene(void) {
                GLfloat fPass;
                GLfloat fPasses = 10.0f;
                // Set the current rotation back a few degrees 
                yRot = 35.0f;
                for (fPass = 0.0f; fPass < fPasses; fPass += 1.0f) {
                    yRot += .75f; //1.0f / (fPass+1.0f); 
                    // Draw sphere 
                    DrawGeometry();
                    // Accumulate to back buffer 
                    if (fPass == 0.0f)
                        glAccum(GL_LOAD, 0.5f);
                    else
                        glAccum(GL_ACCUM, 0.5f * (1.0f / fPasses));
                }

                

                // copy accumulation buffer to color buffer and 
                // do the buffer Swap 
                glAccum(GL_RETURN, 1.0f);
                glutSwapBuffers();



            void glAccum(GLenumm op, GLfloat value);

            Operation Description 
            GL_ACCUM  Scales the color buffer values by value and adds them to the current  contents of the accumulation buffer. 

            GL_LOAD  Scales the color buffer values by value and replaces the current contents  of the accumulation buffer. 

            GL_RETURN  Scales the color values from the accumulation buffer by value and then 
            copies the values to the color buffer. 

            GL_MULT  Scales the color values in the accumulation buffer by value and stores the 
            result in the accumulation buffer. 

            GL_ADD  Scales the color values in the accumulation buffer by value and adds the 
            result to the current accumulation buffer contents. 

            How to scale: ***

            posted on 2009-05-24 03:35 逛奔的蝸牛 閱讀(1795) 評論(0)  編輯 收藏 引用 所屬分類: OpenGL
            中文字幕一区二区三区久久网站| 久久精品国产2020| 国产精品九九久久精品女同亚洲欧美日韩综合区| 综合网日日天干夜夜久久| 亚洲AV无码久久精品色欲| 久久99精品国产一区二区三区| 久久国产香蕉一区精品| 国产毛片欧美毛片久久久| 99久久精品国产一区二区| 热99RE久久精品这里都是精品免费| 久久精品国产亚洲av麻豆小说| 国内精品免费久久影院| 久久亚洲国产成人精品性色| 激情综合色综合久久综合| 久久综合亚洲欧美成人| 亚洲国产日韩欧美久久| 久久精品国产99国产精偷| 久久久久久久久久久精品尤物| 97久久精品人人澡人人爽| 久久国产乱子伦免费精品| 午夜福利91久久福利| 99久久精品免费看国产一区二区三区 | 国产福利电影一区二区三区,免费久久久久久久精| 品成人欧美大片久久国产欧美... 品成人欧美大片久久国产欧美 | 亚洲天堂久久精品| 久久久久成人精品无码中文字幕| 久久青青草原精品国产不卡| 日本精品久久久久中文字幕8| 亚洲av伊人久久综合密臀性色| 欧美亚洲国产精品久久| 婷婷久久综合| 精品久久久久成人码免费动漫 | 波多野结衣中文字幕久久 | 中文精品久久久久人妻| 久久久久亚洲精品无码网址 | 无码AV中文字幕久久专区| 中文字幕精品无码久久久久久3D日动漫 | 看久久久久久a级毛片| 久久中文骚妇内射| 久久久精品2019免费观看| 久久国产精品99久久久久久老狼 |