Engine 1.66 ASSERT FAILED: Framebuffer creation failed

When playing videos in the html video tag I am getting a specific error:


Framebuffer creation failed with error code FRAMEBUFFER_INCOMPLETE_ATTACHMENT, render target: WebglFramebuffer MSAA

[object Object]

When using the 1.65.5 engine the error dissapears.

I made a small example project to show what is happening.


Any ideas?

I’m not sure why this happens, but I can see that when I click on the play video, the canvas the engine uses gets resized to 0,0 and that does not work as it’s not a valid size for framebuffer.

we use canvas.width and canvas.height to get the rendering size each frame - this is what changes to 0,0.

There is this example which does not seem to have this problem: PlayCanvas 3D HTML5 Game Engine

Perhaps somebody could explain the difference her? I’m not very familiar with what happens with canvas on the html side.

For debugging, you can add this line to run once somewhere at startup:

pc.Tracing.set(pc.TRACEID_RENDER_TARGET_ALLOC, true);

and observe the allocations of WebglFramebuffer

initially it’s allocated with correct size:
RenderTargetAlloc | Alloc: Id 3 WebglFramebuffer: 637x1152 [samples: 4][Depth][Stencil][Face:0]

but when the video playback starts, the canvas size changes and we try to allocate this:
RenderTargetAlloc | Alloc: Id 5 WebglFramebuffer: 0x0 [samples: 4][Depth][Stencil][Face:0]

Hey thanks for the test case. This is happening because the canvas display is being set to ‘none’ and it’s causing the canvas width to be zero. Instead try setting the visibility which should hide things but not break the renderer.

document.body.querySelector('#application-canvas').style.visibility = 'hidden'

@mvaligursky we should probably add a check in the updateBackBuffer to guard against when the canvas is 0, 0


yeah I thought about it … but just not sure what to do about if it is zero apart from logging an error. Perhaps that’s better than nothing.

@Mark_Lundin @mvaligursky,

Thank you both!

Setting the visibility instead of display works indeed.