setupFrameBufferTexture method
void
setupFrameBufferTexture(
- dynamic framebuffer,
- RenderTarget renderTarget,
- Texture texture,
- dynamic attachment,
- dynamic textureTarget,
Implementation
void setupFrameBufferTexture(framebuffer, RenderTarget renderTarget, Texture texture, attachment, textureTarget) {
final glFormat = utils.convert(texture.format);
final glType = utils.convert(texture.type);
final glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.encoding);
if (textureTarget == WebGL.TEXTURE_3D || textureTarget == WebGL.TEXTURE_2D_ARRAY) {
state.texImage3D(textureTarget, 0, glInternalFormat, renderTarget.width.toInt(), renderTarget.height.toInt(),
renderTarget.depth.toInt(), 0, glFormat, glType, null);
} else {
state.texImage2D(textureTarget, 0, glInternalFormat, renderTarget.width.toInt(), renderTarget.height.toInt(), 0,
glFormat, glType, null);
}
state.bindFramebuffer(WebGL.FRAMEBUFFER, framebuffer);
if (useMultisampledRenderToTexture(renderTarget)) {
multisampledRenderToTextureExtension.framebufferTexture2DMultisampleEXT(WebGL.FRAMEBUFFER, attachment,
textureTarget, properties.get(texture)["__webglTexture"], 0, getRenderTargetSamples(renderTarget));
} else {
_gl.framebufferTexture2D(
WebGL.FRAMEBUFFER, attachment, textureTarget, properties.get(texture)["__webglTexture"], 0);
}
state.bindFramebuffer(WebGL.FRAMEBUFFER, null);
}