setupFrameBufferTexture method
void
setupFrameBufferTexture(
- dynamic framebuffer,
- RenderTarget renderTarget,
- Texture texture,
- dynamic attachment,
- dynamic textureTarget,
Implementation
void setupFrameBufferTexture(framebuffer, RenderTarget renderTarget, Texture texture, attachment, textureTarget) {
var glFormat = utils.convert(texture.format);
var glType = utils.convert(texture.type);
var glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.encoding);
if (textureTarget == gl.TEXTURE_3D || textureTarget == gl.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(gl.FRAMEBUFFER, framebuffer);
// gl.framebufferTexture2D(gl.FRAMEBUFFER, attachment, textureTarget,
// properties.get(texture)["__webglTexture"], 0);
if (useMultisampledRenderToTexture(renderTarget)) {
multisampledRenderToTextureExtension.framebufferTexture2DMultisampleEXT(_gl.FRAMEBUFFER, attachment,
textureTarget, properties.get(texture)["__webglTexture"], 0, getRenderTargetSamples(renderTarget));
} else {
_gl.framebufferTexture2D(
_gl.FRAMEBUFFER, attachment, textureTarget, properties.get(texture)["__webglTexture"], 0);
}
state.bindFramebuffer(gl.FRAMEBUFFER, null);
}