* To create a WebGL texture, one needs to supply three pieces of information: * the type (the data type each channel will be stored as, e.g. int or float), * the format (the color channels that will each be stored in the previously * specified type, e.g. rgb or rgba), and the internal forma
(framebuffer)
| 1607 | * @private |
| 1608 | */ |
| 1609 | _getFramebufferDepthFormat(framebuffer) { |
| 1610 | let type, format, internalFormat; |
| 1611 | const gl = this.GL; |
| 1612 | |
| 1613 | if (framebuffer.useStencil) { |
| 1614 | if (framebuffer.depthFormat === constants.FLOAT) { |
| 1615 | type = gl.FLOAT_32_UNSIGNED_INT_24_8_REV; |
| 1616 | } else if (this.webglVersion === constants.WEBGL2) { |
| 1617 | type = gl.UNSIGNED_INT_24_8; |
| 1618 | } else { |
| 1619 | type = gl.getExtension('WEBGL_depth_texture').UNSIGNED_INT_24_8_WEBGL; |
| 1620 | } |
| 1621 | } else { |
| 1622 | if (framebuffer.depthFormat === constants.FLOAT) { |
| 1623 | type = gl.FLOAT; |
| 1624 | } else { |
| 1625 | type = gl.UNSIGNED_INT; |
| 1626 | } |
| 1627 | } |
| 1628 | |
| 1629 | if (framebuffer.useStencil) { |
| 1630 | format = gl.DEPTH_STENCIL; |
| 1631 | } else { |
| 1632 | format = gl.DEPTH_COMPONENT; |
| 1633 | } |
| 1634 | |
| 1635 | if (framebuffer.useStencil) { |
| 1636 | if (framebuffer.depthFormat === constants.FLOAT) { |
| 1637 | internalFormat = gl.DEPTH32F_STENCIL8; |
| 1638 | } else if (this.webglVersion === constants.WEBGL2) { |
| 1639 | internalFormat = gl.DEPTH24_STENCIL8; |
| 1640 | } else { |
| 1641 | internalFormat = gl.DEPTH_STENCIL; |
| 1642 | } |
| 1643 | } else if (this.webglVersion === constants.WEBGL2) { |
| 1644 | if (framebuffer.depthFormat === constants.FLOAT) { |
| 1645 | internalFormat = gl.DEPTH_COMPONENT32F; |
| 1646 | } else { |
| 1647 | internalFormat = gl.DEPTH_COMPONENT24; |
| 1648 | } |
| 1649 | } else { |
| 1650 | internalFormat = gl.DEPTH_COMPONENT; |
| 1651 | } |
| 1652 | |
| 1653 | return { internalFormat, format, type }; |
| 1654 | } |
| 1655 | |
| 1656 | _deleteFramebufferTexture(texture) { |
| 1657 | const gl = this.GL; |
no outgoing calls
no test coverage detected