phaser - v4.0.0-rc.4
    Preparing search index...

    Wrapper for a WebGL frame buffer, containing all the information that was used to create it.

    A WebGLFramebuffer should never be exposed outside the WebGLRenderer, so the WebGLRenderer can handle context loss and other events without other systems having to be aware of it. Always use WebGLFramebufferWrapper instead.

    This also manages the attachments to the framebuffer, including renderbuffer life cycle.

    Index

    Constructors

    • Parameters

      • renderer: WebGLRenderer

        The renderer this WebGLFramebuffer belongs to.

      • colorAttachments: WebGLTextureWrapper[]

        The color textures where the color pixels are written. If empty, the canvas will be used as the color attachment. Only the first color attachment is used in default WebGL1.

      • OptionaladdStencilBuffer: boolean

        Whether to add a stencil buffer to the framebuffer. If the canvas is used as the color attachment, this will be ignored. Default false.

      • OptionaladdDepthBuffer: boolean

        Whether to add a depth buffer to the framebuffer. If depth and stencil are both provided, they will be combined into a single depth-stencil buffer. If the canvas is used as the color attachment, this will be ignored. Default false.

      Returns WebGLFramebufferWrapper

    Properties

    attachments: Attachment[]

    Attachments to the framebuffer. These contain data such as the width, height, and renderbuffer or texture.

    height: number

    Height of the depth stencil.

    renderer: WebGLRenderer

    The WebGLRenderer this WebGLFramebuffer belongs to.

    renderTexture: WebGLTextureWrapper

    The color texture where the color pixels are written.

    This will be null if the canvas is used as the color attachment. It is the first color attachment on the framebuffer.

    useCanvas: boolean

    Whether to use the canvas as the color attachment. If this is true, a framebuffer will not be created. This is useful for the main framebuffer, which is created by the browser.

    webGLFramebuffer: WebGLFramebuffer

    The WebGLFramebuffer being wrapped by this class.

    This property could change at any time. Therefore, you should never store a reference to this value. It should only be passed directly to the WebGL API for drawing.

    If the FrameBuffer is using the canvas as the color attachment, this property will be null.

    width: number

    Width of the depth stencil.

    Methods

    • Creates a WebGLFramebuffer from the given parameters.

      This is called automatically by the constructor. It may also be called again if the WebGLFramebuffer needs re-creating.

      Returns void

    • Resizes the attachments of this WebGLFramebufferWrapper.

      Parameters

      • width: number

        The new width of the framebuffer.

      • height: number

        The new height of the framebuffer.

      Returns void