欧美一级特黄大片做受成人-亚洲成人一区二区电影-激情熟女一区二区三区-日韩专区欧美专区国产专区

FillingandCopyingDatainBuffers-創(chuàng)新互聯(lián)

周一到周五,每天一篇,北京時(shí)間早上7點(diǎn)準(zhǔn)時(shí)更新~

創(chuàng)新互聯(lián)專(zhuān)業(yè)為企業(yè)提供襄城網(wǎng)站建設(shè)、襄城做網(wǎng)站、襄城網(wǎng)站設(shè)計(jì)、襄城網(wǎng)站制作等企業(yè)網(wǎng)站建設(shè)、網(wǎng)頁(yè)設(shè)計(jì)與制作、襄城企業(yè)網(wǎng)站模板建站服務(wù),十年襄城做網(wǎng)站經(jīng)驗(yàn),不只是建網(wǎng)站,更提供有價(jià)值的思路和整體網(wǎng)絡(luò)服務(wù)。

After allocating storage space for your buffer object using glBufferStorage(), one possible next step is to fill the buffer with known data. Whether you use the initial data parameter of glBufferStorage(), use glBufferSubData() to put the initial data in the buffer, or use glMapBufferRange() to obtain a pointer to the buffer’s data store and fill it with your application, you will need to get the buffer into a known state before you can use it productively. If the data you want to put into a buffer is a constant value, it is probably much more efficient to call glClearBufferSubData() or glClearNamedBufferSubData(), whose prototypes are

在緩沖區(qū)對(duì)象分配好了內(nèi)存后,下一步可能就輪到給給內(nèi)存填充數(shù)據(jù)了。你可以在分配內(nèi)存的同時(shí)為緩沖區(qū)填充數(shù)據(jù),也可以使用glBufferSubData或者glMapBufferRange在緩沖區(qū)內(nèi)存分配好之后 為緩沖區(qū)填充數(shù)據(jù)。在你使用buffer之前,你需要把buffer置于一個(gè)已知的狀態(tài)。如果你想往緩沖區(qū)里刷入常數(shù),那么你可以使用glClearBufferSubData或者glClearNamedBufferSubData來(lái)高效的做這事。

void glClearBufferSubData(GLenum target,
GLenum internalformat,
GLintptr offset,
GLsizeiptr size,
GLenum format,
GLenum type,
const void data);
void glClearNamedBuffeSubData(GLuint buffer,
GLenum internalformat,
GLintptr offset,
GLsizeiptr size,
GLenum format,
GLenum type,
const void
data);
These functions take a pointer to a variable containing the values that you want to clear the buffer object to and, after converting it to the format specified in internalformat, replicate the data across the range of the buffer’s data store specified by offset and size, both of which are measured in bytes. format and type tell OpenGL about the data pointed to by data. The format can be one of GL_RED, GL_RG, GL_RGB, or GL_RGBA to specify one-, two-, three-, or four-channel data, for example. Meanwhile, type should represent the data type of the components. For instance, it could be GL_UNSIGNED_BYTE or GL_FLOAT to specify unsigned bytes or floating-point data, respectively. The most common types supported by OpenGL and their corresponding C data types are listed in Table 5.3.

這些函數(shù)使用data指針指向位置的數(shù)據(jù)去刷新緩沖區(qū)的內(nèi)存,數(shù)據(jù)會(huì)被轉(zhuǎn)化成internalformat的格式,數(shù)據(jù)刷新的多少由offset和size指定,數(shù)據(jù)大小的單位為字節(jié)。 format和type告訴OpenGL,data指針指向的數(shù)據(jù)的格式,format的值可以是GGL_RED, GL_RG, GL_RGB,或者 GL_RGBA,用來(lái)標(biāo)記數(shù)據(jù)是1、2、3、4通道的數(shù)據(jù)。type這里指定的是每個(gè)通道是什么格式。 比如,它可能是GL_UNSIGNED_BYTE或者GL_FLOAT。比較常見(jiàn)的類(lèi)型在表5.3里展示出來(lái)了
Filling and Copying Data in Buffers
Once your data has been sent to the GPU, it’s entirely possible you may want to share that data between buffers or copy the results from one buffer into another. OpenGL provides an easy-to-use way of doing that. glCopyBufferSubData() and glCopyNamedBufferSubData() let you specify which buffers are involved as well as the size and offsets to use.

當(dāng)你把數(shù)據(jù)發(fā)送給GPU后,你可能希望與其他buffer共享數(shù)據(jù)或者是從一個(gè)buffer拷貝數(shù)據(jù)到另一個(gè)buffer。OpenGL提供的對(duì)應(yīng)的API是 glCopyBufferSubData和glCopyNamedBufferSubData,他們的定義如下

void glCopyBufferSubData(GLenum readtarget,
GLenum writetarget,
GLintptr readoffset,
GLintptr writeoffset,
GLsizeiptr size);
void glCopyNamedBufferSubData(GLuint readBuffer,
GLuint writeBuffer,
GLintptr readOffset,
GLintptr writeOffset,
GLsizeiptr size);
For glCopyBufferSubData(), the readtarget and writetarget are the targets where the two buffers you want to copy data between are bound. They can be buffers bound to any of the available buffer binding points. However, since buffer binding points can have only one buffer bound at a time, you couldn’t copy between two buffers that are both bound to the GL_ARRAY_BUFFER target, for example. Thus, when you perform the copy, you need to pick two targets to bind the buffers to, which will disturb the OpenGL state.

glCopyBufferSubData的數(shù)據(jù)讀取地址和數(shù)據(jù)寫(xiě)入地址只某個(gè)綁定的節(jié)點(diǎn)而不是buffer對(duì)象本身的標(biāo)記。然而每個(gè)特定的綁定節(jié)點(diǎn)只能綁定一個(gè)buffer,所以你無(wú)法將兩個(gè)都綁定在GL_ARRAY_BUFFER 上的buffer進(jìn)行數(shù)據(jù)拷貝。所以,在你要拷貝的時(shí)候,你需要將buffer綁定到兩個(gè)綁定節(jié)點(diǎn)上去,然后執(zhí)行拷貝操作,這實(shí)際上會(huì)擾亂OpenGL狀態(tài)機(jī)

To resolve this, OpenGL provides the GL_COPY_READ_BUFFER and GL_COPY_WRITE_BUFFER targets. These targets were added specifically to allow you to copy data from one buffer to another without any unintended side effects. Because they are not used for anything else in OpenGL, you can bind your read and write buffers to these binding points without affecting any other buffer target.

為了實(shí)現(xiàn)這一目標(biāo),OpenGL提供兩個(gè)專(zhuān)門(mén)的綁定節(jié)點(diǎn),GL_COPY_READ_BUFFER和GL_COPY_WRITE_BUFFER,這倆節(jié)點(diǎn)能執(zhí)行buffer間的數(shù)據(jù)拷貝,并且沒(méi)有什么副作用。 因?yàn)檫@倆貨除了具備拷貝功能以外不會(huì)有其他功能,所以你執(zhí)行buffer間拷貝的時(shí)候,改變這倆個(gè)節(jié)點(diǎn)的狀態(tài)不會(huì)影響到其他的OpenGL的邏輯。

Alternatively, you can use the glCopyNamedBufferSubData() form, which takes the names of the two buffers directly. Of course, you can specify the same buffer for both readBuffer and writeBuffer to copy a region of data between two offsets in the same buffer object. Be careful that the regions to be copied don’t overlap, though, as in this case the results of the copy are undefined. You can consider glCopyNamedBufferSubData() as a form of the C function memcpy for buffer objects.

同樣的,你可以使用第二個(gè)glCopyNamedBufferSubData,直接傳入寫(xiě)數(shù)據(jù)的地址和讀數(shù)據(jù)的地址。你同樣可以指定寫(xiě)入和讀取的是同一個(gè)buffer,并在buffer內(nèi)的不同區(qū)域內(nèi)進(jìn)行數(shù)據(jù)的拷貝。你可以把這個(gè)函數(shù)想象成為memcpy

The readoffset and writeoffset parameters tell OpenGL where in the source and destination buffers to read or write the data, and the size parameter tells it how big the copy should be. Be sure that the ranges you are reading from and writing to remain within the bounds of the buffers; otherwise, your copy will fail. You may notice the types of readoffset, writeoffset, and size, which are GLintptr and GLsizeiptr. These types are special definitions of integer types that are at least wide enough to hold a pointer variable

readoffset和writeoffset告訴OpenGL讀地址和寫(xiě)地址的數(shù)據(jù)偏移位置。size告訴OpenGL拷貝數(shù)據(jù)的大小。你必須保證別越界了,否則你的拷貝會(huì)失敗。 你可能注意到了GLintptr和GLsizeiptr,這些數(shù)據(jù)都是整型的數(shù)據(jù),它們對(duì)于標(biāo)記指針的地址來(lái)說(shuō)已經(jīng)足夠大了。

本日的翻譯就到這里,明天見(jiàn),拜拜~~

第一時(shí)間獲取最新橋段,請(qǐng)關(guān)注東漢書(shū)院以及圖形之心公眾號(hào)

東漢書(shū)院,等你來(lái)玩哦

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

網(wǎng)站標(biāo)題:FillingandCopyingDatainBuffers-創(chuàng)新互聯(lián)
文章URL:http://aaarwkj.com/article32/dshppc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供響應(yīng)式網(wǎng)站企業(yè)網(wǎng)站制作、移動(dòng)網(wǎng)站建設(shè)、關(guān)鍵詞優(yōu)化微信小程序、網(wǎng)頁(yè)設(shè)計(jì)公司

廣告

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

營(yíng)銷(xiāo)型網(wǎng)站建設(shè)
很黄无遮挡在线免费网站| 视频一区二区三区拍拍| 日韩精品在线播放观看| 欧美亚洲中文字幕高清| 国产三级全黄在线播放| 国产成av人片乱码色午夜| 亚洲欧美成人免费视频| 国产级一片内射视步页| 国产区精品福利在线熟女| 国产三级精品电影久久| 亚洲激情av在线观看| 久久最新最热视频精品| 日本一道二区三区我不卡| 国产精品 亚洲精品| 中文字幕人成乱码在线观看| 亚洲最大成人av在线| 国产在线精品91国自产拍| 午夜精品一区二区三区在线视频| 青青草原高清在线观看 | 最新国产激情福利网站| 精品午夜免费福利视频| 午夜视频在线观看日韩| 青青草国产成人自拍视频在线观看 | 99热这里只有精品中文| 欧美三级在线完整版免费| 亚洲乱码一区二区av| 欧美一区二区三区精美| 亚洲女同另类在线播放视频| 亚洲欧美半夜激情一区二区| 操国产熟女大白屁股| 国内精品久久久久久2021| 黄色av网站在线免费| 日本特黄特色大片免费| 国产精品一区二区久久毛片| 97在线公开免费视频| 福利在线视频一区二区| 自拍偷拍欧美日韩第一页| 日韩中文不卡人成在线视频| 中文字幕一区二区三天| 欧美日韩激情在线不卡三区| 欧美伊人久久大综合精品|