1
我的OpenGL場景具有兩個通行證 - 一個這使得整個場景(顏色和深度)和第二這使得只有一些場景中的對象,這需要從所述第一通深度緩衝器。綁定相同的渲染到多個宗教組織
是否可以使用兩種幀緩衝對象FBO1和FBO2,並以相同的深度渲染綁定到他們兩個?該僞代碼如下:
// ---------- Initialization ----------
// create 'FBO1'
// create render buffer 'RB'
// bind RB to FBO1
// bind TEXTURE1 to FBO1 for color rendering
// create FBO2
// bind RB to FBO2
// bind TEXTURE2 to FBO2 for color rendering
// ---------- Rendering frame----------
// bind FBO1
// render entire scene with depth writing enabled
// bind FB2
// render some objects again with depth mask GL_EQUAL
的結果應該是紋理2僅包含未通過在第一遍呈現其他對象遮擋的物體的那些部分。
你的意思是在同* * FBO多個附件,對不對? –
@NicolBolas:當然。我編輯了我的答案,使其清晰(呃)。 – datenwolf
所以我可以使用其中一個FBO讀取深度緩衝區,同時使用另一個作爲渲染目標並寫入它? – Cheeku