to make simulations on GPU, I have to ping-pong 2 textures with data. In
WebGL 1 I used 2 FBO but
"Avoid extraneous glBindFramebuffer calls. Use multiple attachments to a
FBO rather than managing multiple FBOs." OpenGL Insights
therefore, I make FBO with 2 texures
FBO = gl.createFramebuffer()
gl.bindFramebuffer(gl.FRAMEBUFFER, FBO)
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0,
gl.TEXTURE_2D, texture, 0)
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT1,
gl.TEXTURE_2D, texture1, 0)
if( gl.checkFramebufferStatus(gl.FRAMEBUFFER) !=
gl.FRAMEBUFFER_COMPLETE) alert("FBOs are not complete")
and trying something like this
gl.bindFramebuffer(gl.FRAMEBUFFER, FBO)
gl.uniform1i(sampLoc, 0) // input texture
gl.drawBuffers([gl.COLOR_ATTACHMENT1]) // output texture
// gl.bindFramebuffer(gl.FRAMEBUFFER, FBO1) // used in WebGL 1
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4)
See
http://www.ibiblio.org/e-notes/webgl/gpu/flat_wave2mu.htm
I get in Canary
INVALID_OPERATION: drawBuffers: COLOR_ATTACHMENTi_EXT or NONE
what is wrong?
Evgeny