您可以使用FBO來實現您最有可能與累積緩衝區一起使用的相同類型的抗鋸齒功能。除了使用紋理/渲染緩衝區作爲「累積緩衝區」之外,該過程幾乎相同。您可以爲流程使用兩個FBO,也可以更改單個渲染FBO的附加渲染目標。
在僞代碼,使用兩個宗教組織,流程看起來大致是這樣的:
create renderbuffer rbA
create fboA (will be used for accumulation)
bind fboA
attach rbA to fboA
clear
create texture texB
create fboB (will be used for rendering)
attach texB to fboB
(create and attach a renderbuffer for the depth buffer)
loop over jitter offsets
bind fboB
clear
render scene, with jitter offset applied
bind fboA
bind texB for texturing
set blend function GL_CONSTANT_ALPHA, GL_ONE
set blend color 0.0, 0.0, 0.0, 1.0/#passes
enable blending
render screen size quad with simple texture sampling shader
disable blending
end loop
bind fboA as read_framebuffer
bind default framebuffer as draw framebuffer
blit framebuffer
完全超級採樣也是可能的。正如上面評論中的Andon所建議的那樣,您可以創建一個FBO,其渲染目標是每個維度中窗口大小的倍數,最後在窗口中執行縮小比例。整個事情往往是緩慢的,並使用大量的內存,即使只有2倍。
您定位的GL版本是什麼?累積緩衝區在GL 3.0中已棄用,並在3.1(不含'GL_ARB_compatibility')/ 3.2+ * Core *中刪除。這就是爲什麼你不能在OS X或Intel的驅動程序上找到它們的原因。代替累積緩衝區,您是否考慮過將您的默認幀緩衝區的尺寸的整數倍乘以FBO,然後使用簡單的'GL_LINEAR'過濾器進行下采樣? –
嗨安東,謝謝你的回覆。 – Fravadona
我正在考慮採用與古代現代OpenGL實現相兼容的方式,實現高質量場景消除鋸齒(用於保存圖像)的任何方法。 現在,我將在互聯網上尋找任何「GLX FBO GL_LINEAR縮減採樣」示例。 – Fravadona