Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • Regl

Callable

  • Regl<Uniforms, Attributes, Props, OwnContext, ParentContext>(drawConfig: DrawConfig<Uniforms, Attributes, Props, OwnContext, ParentContext>): DrawCommand<ParentContext & OwnContext, Props>
  • Creates a new REGL command. The resulting command, when executed, will set a WebGL state machine to a specified state.

    Type Parameters

    • Uniforms extends {} = {}

    • Attributes extends {} = {}

    • Props extends {} = {}

    • OwnContext extends {} = {}

    • ParentContext extends DefaultContext = DefaultContext

    Parameters

    • drawConfig: DrawConfig<Uniforms, Attributes, Props, OwnContext, ParentContext>

    Returns DrawCommand<ParentContext & OwnContext, Props>

Index

Properties

_gl: WebGLRenderingContext

regl is designed in such a way that you should never have to directly access the underlying WebGL context. However, if you really absolutely need to do this for some reason (for example to interface with an external library), you can still get a reference to the WebGL context via the property _gl.

attributes: WebGLContextAttributes

The context creation attributes passed to the WebGL context constructor.

limits: Limits

regl exposes info about the WebGL context limits and capabilities via the limits object.

stats: Stats

regl tracks several metrics for performance monitoring. These can be read using the stats object.

Methods

  • _refresh(): void
  • regl is designed in such a way that you should never have to directly access the underlying WebGL context. However, if you really absolutely need to do this for some reason (for example to interface with an external library), you can still get a reference to the WebGL context via the property REGL._gl. Note, though, that if you have changed the WebGL state, you must call _refresh to restore the regl state in order to prevent rendering errors.

    Returns void

  • Clears selected buffers to specified values. If an option is not present, then the corresponding buffer is not cleared. Relevant WebGL API: gl.clear

    Parameters

    Returns void

  • destroy(): void
  • draw(): void
  • Registers a callback to be called on each animation frame.

    This method integrates with requestAnimationFrame and context loss events. It also calls gl.flush and drains several internal buffers, so you should try to do all your rendering to the drawing buffer within the frame callback.

    Parameters

    Returns Cancellable

  • hasExtension(name: string): boolean
  • Test if an extension is present. Argument is case insensitive.

    For more information on WebGL extensions, see the WebGL extension registry.

    Relevant WebGL APIs

    Parameters

    • name: string

      case-insensitive name of WebGL extension

    Returns boolean

  • now(): number
  • poll(): void
  • Updates the values of internal times and recalculates the size of viewports.

    Returns void

  • Dynamic variable binding

    prop, context, and this generate DynamicVariables, which can be used as values in a REGL.DrawConfig object. A DynamicVariable is an abstraction that will render a value only when the DrawCommand with which it's associated is invoked.

    Type Parameters

    • Props extends {}

    • Key extends string | number | symbol

    Parameters

    • name: Key

    Returns DynamicVariable<Props[Key]>

  • read<T>(): T
  • read<T>(data: T): T
  • read<T>(options: ReadOptions<T>): T
  • Read entire screen. NB: Reading into a Float32Array requires OES_texture_float.

    Type Parameters

    • T extends Uint8Array | Float32Array = Uint8Array

    Returns T

  • Read entire screen into an existing TypedArray. NB: Reading into a Float32Array requires OES_texture_float.

    Type Parameters

    • T extends Uint8Array | Float32Array

    Parameters

    • data: T

    Returns T

  • Read a selected region of screen or framebuffer. NB: Reading into a Float32Array requires OES_texture_float.

    Type Parameters

    • T extends Uint8Array | Float32Array = Uint8Array

    Parameters

    Returns T

Generated using TypeDoc