FrameBuffer

How to create

var buffer = render.createFramebuffer()

To maintain the size of the framebuffer with the screen size you have to do the following code in Render2D

var buffer = render.createFramebuffer()

script.onRender2D(function(event) {
    buffer.resize()
})

Functions

resize

buffer.resize()

This updates the framebuffer size with the current screen size

clear

buffer.clear()

This clears the framebuffer

bind

buffer.bind()

Binds the framebuffer to what is rendering next

unbind

buffer.unbind()

Unbinds the framebuffer

getTextureID

var textureID = buffer.getTextureID()

Returns the texture ID as a Number

getWidth

var framebufferWidth = buffer.getWidth()

Returns the framebuffer width as a Number

getHeight

var framebufferHeight = buffer.getHeight()

Returns the framebuffer height as a Number

Last updated