FramebufferOperations(幀緩沖區(qū)的操作)-創(chuàng)新互聯(lián)

周一到周五,每天一篇,北京時間早上7點準時更新~,中英文對照,一邊學(xué)編程一邊彈吉他,做一個奇葩碼農(nóng)!

在陽原等地區(qū),都構(gòu)建了全面的區(qū)域性戰(zhàn)略布局,加強發(fā)展的系統(tǒng)性、市場前瞻性、產(chǎn)品創(chuàng)新能力,以專注、極致的服務(wù)理念,為客戶提供網(wǎng)站建設(shè)、成都網(wǎng)站制作 網(wǎng)站設(shè)計制作按需求定制制作,公司網(wǎng)站建設(shè),企業(yè)網(wǎng)站建設(shè),成都品牌網(wǎng)站建設(shè),營銷型網(wǎng)站,外貿(mào)網(wǎng)站建設(shè),陽原網(wǎng)站建設(shè)費用合理。

The framebuffer is the last stage of the OpenGL graphics pipeline(幀緩沖區(qū)是OpenGL圖形管線的最后一個階段). It can represent the visible content of the screen and a number of additional regions of memory that are used to store per-pixel values other than color(它可以表示屏幕可見區(qū)域的部分自己一些存儲里與這些像素有關(guān)的其他非顏色信息的內(nèi)存塊). On most platforms, this means the window you see on your desktop(在大多數(shù)平臺上,幀緩沖區(qū)指代的是窗口) (or possibly the whole screen if your application covers it), which is owned by the operating system (這個操作系統(tǒng)所管理的)(or windowing system to be more precise). The framebuffer provided by the windowing system is known as the default framebuffer, but it is possible to provide your own if you wish to do things like render into off-screen areas(操作系統(tǒng)所管理的幀緩沖區(qū)我們稱之為默認的緩沖區(qū),你也可以創(chuàng)建你自己的緩沖區(qū)用于離線渲染). The state held by the framebuffer includes information such as where the data produced by your fragment shader should be written, (幀緩沖區(qū)擁有的信息包括由你的fragment shader產(chǎn)生的數(shù)據(jù)應(yīng)該寫到哪里去)what the format of that data should be, and so on(被寫入的數(shù)據(jù)應(yīng)該是什么等等這類的信息). This state is stored in a framebuffer object(這些信息都存儲在幀緩沖區(qū)里). Also considered part of the framebuffer, but not stored per framebuffer object, is the pixel operation state(像素操作階段,幀緩沖區(qū)可能只有部分進行這個操作,而不是整個幀緩沖區(qū))

Pixel Operations(像素操作)

After the fragment shader has produced an output(在fragment shader產(chǎn)生了輸出之后), several things may happen to the fragment before it is written to the window(在像素被寫到窗口上之前,會發(fā)生很多個操作), such as a determination of whether it even belongs in the window(比如判斷該像素是否屬于這個窗口的問題). Each of these things may be turned on or off by your application(每一個操作都可以被你開啟和關(guān)閉). The first thing that could happen is the scissor test, which tests your fragment against a rectangle that you can define(第一個事情就是scissor測試,你可以定義一個矩形來測試的你像素). If it’s inside the rectangle, then it will be processed further; if it’s outside, it will be thrown away(如果這個像素在矩形里面,那么這個矩形就會被傳輸給下一個階段進行處理,否則會被丟棄)

Next comes the stencil test. This compares a reference value provided by your application with the contents of the stencil buffer, which stores a single4 value per pixel(下一個階段就是蒙版測試,它會根據(jù)你蒙版緩沖區(qū)里的值來進行處理). The content of the stencil buffer has no particular semantic meaning and can be used for any purpose(蒙版測試是一個通用的操作,可以被用于任何事情)

After the stencil test has been performed, the depth test is performed. The depth test is an operation that compares the fragment’s z coordinate against the contents of the depth buffer(蒙版測試之后就輪到深度測試了,深度測試測試的是你當前繪制的像素是否被遮擋的問題). The depth buffer is a region of memory that, like the stencil buffer, is part of the framebuffer with enough space for a single value for each pixel; it contains the depth (which is related to distance from the viewer) of each pixel(深度緩沖器存儲著每個像素對應(yīng)的深度信息)

Normally, the values in the depth buffer range from 0 to 1, with 0 being the closest possible point in the depth buffer and 1 being the furthest possible point in the depth buffer(一般來說,深度的信息范圍是0~1,0表示離你最近的深度,1表示離你最遠的深度). To determine whether a fragment is closer than other fragments that have already been rendered in the same place(為了判斷某一個像素比同一個位置的其他像素離你是否更近), OpenGL can compare the z component of the fragment’s window-space coordinate against the value already in the depth buffer(OpenGL會拿當前像素的z的值與深度緩沖區(qū)上的z的值進行比較). If this value is less than what’s already there, then the fragment is visible. The sense of this test can also be changed(如果當前像素的深度值比深度緩沖區(qū)上的z的值小,則該像素可見,否則不可見). For example, you can ask OpenGL to let fragments through that have a z coordinate that is greater than, equal to, or not equal to the content of the depth buffer(比如你當前渲染的像素的z的值比深度緩沖區(qū)里的對應(yīng)的z的值大,那么當前像素則不會被寫入當前的顏色緩沖區(qū)里去). The result of the depth test also affects what OpenGL does to the stencil buffer(深度測試的結(jié)果也會影響到蒙版緩沖區(qū)里的內(nèi)容).

Next, the fragment’s color is sent to either the blending or logical operation stage(接下來像素顏色被發(fā)送給混合或者是alpha邏輯操作的階段), depending on whether the framebuffer is considered to store floating-point, normalized, or integer values(這取決于幀緩沖區(qū)里存儲的數(shù)據(jù)是浮點數(shù)據(jù)還是單位化的數(shù)據(jù)還是整數(shù)). If the content of the framebuffer is either floating-point or normalized integer values, then blending is applied(如果幀緩沖區(qū)的數(shù)據(jù)格式是浮點數(shù)或者是單位化的整數(shù),那么下一個階段就是混合了). Blending is a highly configurable stage in OpenGL and will be covered in detail in its own section.(混合是一個非常具備可操作性的階段,所以我們將在它自己的章節(jié)詳細展開講解)

In short, OpenGL is capable of using a wide range of functions that take components of the output of your fragment shader and of the current content of the framebuffer and calculate new values that are written back to the framebuffer(簡單來說,OpenGL可以通過一大堆函數(shù)來操作你fragment shader輸出的內(nèi)容與幀緩沖區(qū)的內(nèi)容,并且計算出新的數(shù)據(jù)最終寫回幀緩沖區(qū)). If the framebuffer contains unnormalized integer values(如果幀緩沖區(qū)里是沒有單位化的整型數(shù)據(jù)), then logical operations such as logical AND, OR, and XOR can be applied to the output of your shader and the value currently in the framebuffer to produce a new value that will be written back into the framebuffer(那么下一個處理階段就是邏輯操作了,使用and、or、XOR來操作當前像素與幀緩沖區(qū)里的數(shù)據(jù),并最終將結(jié)果寫回幀緩沖區(qū))

本日的翻譯就到這里,明天見,拜拜~~

第一時間獲取最新橋段,請關(guān)注東漢書院以及圖形之心公眾號

東漢書院,等你來玩哦

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機、免備案服務(wù)器”等云主機租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。

當前名稱:FramebufferOperations(幀緩沖區(qū)的操作)-創(chuàng)新互聯(lián)
地址分享:http://www.muchs.cn/article42/dhcchc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供搜索引擎優(yōu)化網(wǎng)站設(shè)計、營銷型網(wǎng)站建設(shè)、面包屑導(dǎo)航、軟件開發(fā)、網(wǎng)站改版

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都定制網(wǎng)站建設(shè)