周一到周五,每天一篇,北京時(shí)間早上7點(diǎn)準(zhǔn)時(shí)更新~,中英文對(duì)照,一邊學(xué)編程一邊彈吉他,做一個(gè)奇葩碼農(nóng)!
在陽(yáng)原等地區(qū),都構(gòu)建了全面的區(qū)域性戰(zhàn)略布局,加強(qiáng)發(fā)展的系統(tǒng)性、市場(chǎng)前瞻性、產(chǎn)品創(chuàng)新能力,以專注、極致的服務(wù)理念,為客戶提供網(wǎng)站建設(shè)、成都網(wǎng)站制作 網(wǎng)站設(shè)計(jì)制作按需求定制制作,公司網(wǎng)站建設(shè),企業(yè)網(wǎng)站建設(shè),成都品牌網(wǎng)站建設(shè),營(yíng)銷型網(wǎng)站,外貿(mào)網(wǎng)站建設(shè),陽(yáng)原網(wǎng)站建設(shè)費(fèi)用合理。The framebuffer is the last stage of the OpenGL graphics pipeline(幀緩沖區(qū)是OpenGL圖形管線的最后一個(gè)階段). 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ū)域的部分自己一些存儲(chǔ)里與這些像素有關(guān)的其他非顏色信息的內(nèi)存塊). On most platforms, this means the window you see on your desktop(在大多數(shù)平臺(tái)上,幀緩沖區(qū)指代的是窗口) (or possibly the whole screen if your application covers it), which is owned by the operating system (這個(gè)操作系統(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ū)我們稱之為默認(rèn)的緩沖區(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(這些信息都存儲(chǔ)在幀緩沖區(qū)里). Also considered part of the framebuffer, but not stored per framebuffer object, is the pixel operation state(像素操作階段,幀緩沖區(qū)可能只有部分進(jìn)行這個(gè)操作,而不是整個(gè)幀緩沖區(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(在像素被寫到窗口上之前,會(huì)發(fā)生很多個(gè)操作), such as a determination of whether it even belongs in the window(比如判斷該像素是否屬于這個(gè)窗口的問題). Each of these things may be turned on or off by your application(每一個(gè)操作都可以被你開啟和關(guān)閉). The first thing that could happen is the scissor test, which tests your fragment against a rectangle that you can define(第一個(gè)事情就是scissor測(cè)試,你可以定義一個(gè)矩形來測(cè)試的你像素). If it’s inside the rectangle, then it will be processed further; if it’s outside, it will be thrown away(如果這個(gè)像素在矩形里面,那么這個(gè)矩形就會(huì)被傳輸給下一個(gè)階段進(jìn)行處理,否則會(huì)被丟棄)
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(下一個(gè)階段就是蒙版測(cè)試,它會(huì)根據(jù)你蒙版緩沖區(qū)里的值來進(jìn)行處理). The content of the stencil buffer has no particular semantic meaning and can be used for any purpose(蒙版測(cè)試是一個(gè)通用的操作,可以被用于任何事情)
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(蒙版測(cè)試之后就輪到深度測(cè)試了,深度測(cè)試測(cè)試的是你當(dāng)前繪制的像素是否被遮擋的問題). 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(深度緩沖器存儲(chǔ)著每個(gè)像素對(duì)應(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表示離你最遠(yuǎn)的深度). To determine whether a fragment is closer than other fragments that have already been rendered in the same place(為了判斷某一個(gè)像素比同一個(gè)位置的其他像素離你是否更近), OpenGL can compare the z component of the fragment’s window-space coordinate against the value already in the depth buffer(OpenGL會(huì)拿當(dāng)前像素的z的值與深度緩沖區(qū)上的z的值進(jìn)行比較). If this value is less than what’s already there, then the fragment is visible. The sense of this test can also be changed(如果當(dāng)前像素的深度值比深度緩沖區(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(比如你當(dāng)前渲染的像素的z的值比深度緩沖區(qū)里的對(duì)應(yīng)的z的值大,那么當(dāng)前像素則不會(huì)被寫入當(dāng)前的顏色緩沖區(qū)里去). The result of the depth test also affects what OpenGL does to the stencil buffer(深度測(cè)試的結(jié)果也會(huì)影響到蒙版緩沖區(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ū)里存儲(chǔ)的數(shù)據(jù)是浮點(diǎn)數(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ù)格式是浮點(diǎn)數(shù)或者是單位化的整數(shù),那么下一個(gè)階段就是混合了). Blending is a highly configurable stage in OpenGL and will be covered in detail in its own section.(混合是一個(gè)非常具備可操作性的階段,所以我們將在它自己的章節(jié)詳細(xì)展開講解)
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(簡(jiǎn)單來說,OpenGL可以通過一大堆函數(shù)來操作你fragment shader輸出的內(nèi)容與幀緩沖區(qū)的內(nèi)容,并且計(jì)算出新的數(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(那么下一個(gè)處理階段就是邏輯操作了,使用and、or、XOR來操作當(dāng)前像素與幀緩沖區(qū)里的數(shù)據(jù),并最終將結(jié)果寫回幀緩沖區(qū))
本日的翻譯就到這里,明天見,拜拜~~
第一時(shí)間獲取最新橋段,請(qǐng)關(guān)注東漢書院以及圖形之心公眾號(hào)
東漢書院,等你來玩哦
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。
當(dāng)前名稱:FramebufferOperations(幀緩沖區(qū)的操作)-創(chuàng)新互聯(lián)
地址分享:http://jinyejixie.com/article42/dhcchc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供搜索引擎優(yōu)化、網(wǎng)站設(shè)計(jì)、營(yíng)銷型網(wǎng)站建設(shè)、面包屑導(dǎo)航、軟件開發(fā)、網(wǎng)站改版
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容