Class: FramebufferTexture

FramebufferTexture(gl, width, height, depth)

Represents an off-screen WebGL framebuffer. The framebuffer has color buffer stored in a 32 bit RGBA texture, and has an optional depth buffer of at least 16 bits. Applications typically do not interact with this class. WebGL framebuffers are created by instances of this class and made current when the DrawContext.bindFramebuffer function is invoked.

Constructor

new FramebufferTexture(gl, width, height, depth)

Constructs a framebuffer texture with the specified dimensions and an optional depth buffer. Use the DrawContext.bindFramebuffer function to make the program current during rendering.
Parameters:
Name Type Description
gl WebGLRenderingContext The current WebGL rendering context.
width Number The width of the framebuffer, in pixels.
height Number The height of the framebuffer, in pixels.
depth Boolean true to configure the framebuffer with a depth buffer of at least 16 bits, false to disable depth buffering.
Source:
Throws:
If the specified draw context is null or undefined, or if the width or height is less than zero.
Type
ArgumentError

Members

(readonly) depth :Boolean

Indicates whether or not this framebuffer has a depth buffer.
Type:
  • Boolean
Source:

(readonly) framebufferId :WebGLFramebuffer

Indicates the WebGL framebuffer object object associated with this framebuffer texture.
Type:
  • WebGLFramebuffer
Source:

(readonly) height :Number

The height of this framebuffer, in pixels.
Type:
  • Number
Source:

(readonly) size :Number

Indicates the size of this framebuffer's WebGL resources, in bytes.
Type:
  • Number
Source:

(readonly) width :Number

The width of this framebuffer, in pixels.
Type:
  • Number
Source:

Methods

bind(dc) → {Boolean}

Binds this off-screen framebuffer's texture in the current WebGL graphics context. This texture contains color fragments resulting from WebGL operations executed when this framebuffer is bound by a call to FramebufferTexture.bindFramebuffer.
Parameters:
Name Type Description
dc DrawContext The current draw context.
Source:
Returns:
true if this framebuffer's texture was bound successfully, otherwise false.
Type
Boolean