我讀了分層渲染,我們創建了一個2D紋理陣列(GL_TEXTURE_2D_ARRAY):如何以可視方式定義將紋理陣列附加到FBO的顏色附着點?
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D_ARRAY, TextureColorbufferName);
glTexParameteri(....
glTexImage3D(...
,並可以將其連接到FBO:
glGenFramebuffers(1, &FramebufferName);
glBindFramebuffer(GL_FRAMEBUFFER, FramebufferName);
glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, TextureColorbufferName, 0);
什麼,我覺得很難直觀地瞭解如何能一層紋理綁定到FBO中的單個顏色附着點上? Isnt顏色附件0(或任何GL_COLOR_ATTACHMENTi)本身是一個單獨的「圖像」?
的詳細信息:
閱讀紋理數組之前,這是我的FBOS
+--------------+
+-----------+| FBO object ++--------------------------------------------+
| | +---------------------+ |
| +--------------+ | |
| + | |
| | | |
| | | |
v v v v
+-----------------+ +-----------------+ +-----------------+ +------------------+
|color attachment | |color attachment | |depth attachment | |stencil attachment|
| 0 | | 1 | | | | |
+-----------------+ +-----------------+ +-----------------+ +------------------+
(this too)
(this is actually (this is also a (this too)
one texture or texture of renderbuffer)
one renderbuffer)
但理解閱讀紋理數組後,這是怎麼真的是?
+--------------+
+-----------+| FBO object ++--------------------------------------------+
| | +---------------------+ |
| +--------------+ | |
| + | |
| | | |
| | | |
v v v v
+-----------------+ +-----------------+ +-----------------+ +------------------+
|color attachment | |color attachment | |depth attachment | |stencil attachment|
| 0 | | 1 | | | | |
+-----+--+------+-+ +-----------------+ +-----------------+ +------------------+
| | |
| | v+
| v+ +----------------------------------+
| +--------->+ v
v | +
+----------------+ +---v-------------+ |
| | | | +---v------------+
|texture array[0]| |texture array[1] | |texture array[n]|
| | | | | |
| | | | | |
| | | | | |
+----------------+ +-----------------+ +----------------+
即,每個附件本身都是各種紋理的集合嗎?
這對我來說很難想像1個顏色附着點如何映射到多個紋理。
如果i從1個FBO(綁定到texture_2d_array一個)BitBlt到另一個(一個綁定到texture_2d),會發生什麼
我真的不明白這個問題。它的工作原理是因爲OpenGL定義它*可以工作*。進入framebuffer綁定點的內容正是OpenGL *所說的內容之一。 –
我編輯了我的問題更詳細。謝謝 – viktorzeid