Reputation: 619
How do I get the maximum number of possibly allocated framebuffers in WebGL? I assume you use getParameter
but I don't know what to pass in it. For the maximum amount of color attchements I know I can pass MAX_DRAW_BUFFERS_WEBGL
, but i don't know about allocated framebuffers.
Also what does the WebGL 1.0 and 2.0 specs say for the minimum required number of framebuffers possibly allocated and color attachments that can be drawn to and attached at once?
Thanks in advance!
Upvotes: 2
Views: 510
Reputation: 8153
There is no hard limit on framebuffers, after all they're not resource intensive, their attachments are.
As to the number of supported color attachments, according to section 6.8 in the WebGL 1 spec:
The following combinations of framebuffer object attachments, when all of the attachments are framebuffer attachment complete, non-zero, and have the same width and height, must result in the framebuffer being framebuffer complete:
COLOR_ATTACHMENT0 = RGBA/UNSIGNED_BYTE texture
COLOR_ATTACHMENT0 = RGBA/UNSIGNED_BYTE texture + DEPTH_ATTACHMENT = DEPTH_COMPONENT16 renderbuffer
COLOR_ATTACHMENT0 = RGBA/UNSIGNED_BYTE texture + DEPTH_STENCIL_ATTACHMENT = DEPTH_STENCIL renderbuffer
So that's minimum required number of color attachments: 1
There's no required minimum number of enabled draw buffers(=attachments) in the WebGL 2 spec nor in the ES 3.0 spec, instead it's implementation specific and needs to be queried through the means you already mentioned, I believe the defacto minimum to be 4
though.
Upvotes: 3