1. 程式人生 > >WEBGL_draw_buffers RENDER WARNING: texture bound to texture unit 0 is not..錯誤解決方案

WEBGL_draw_buffers RENDER WARNING: texture bound to texture unit 0 is not..錯誤解決方案

今天在調整渲染系統中的一個MRT機制,結果不小心改錯了邏輯,執行報錯資訊:[.WebGL-00000000051B4190]RENDER WARNING: texture bound to texture unit 0 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.

折騰了半天,結果是因為邏輯問題,沒有給framebufferTexture2D()中用到的繫結到多目標的紋理物件的兩個屬性gl.TEXTURE_MIN_FILTER和gl.TEXTURE_MAG_FILTER設定正確的引數,設定好了就沒事了,例如:

gl.texParameteri(texTarget, gl.TEXTURE_MIN_FILTER, gl.NEAREST);

gl.texParameteri(texTarget, gl.TEXTURE_MAG_FILTER, gl.LINEAR);