wtc-gl
    Preparing search index...

    Class Renderer

    Create a renderer. This is responsible for bringing together the whole state and, eventually, rendering to screen.

    Index

    Constructors

    Properties

    alpha: boolean

    Whether to render an alpha channel. This property is passed to the rendering context.

    false
    
    autoClear: boolean

    Whether to automatically clear the buffers before render.

    true
    
    bindVertexArray: (vertexArray: WebGLVertexArrayObject | null) => void

    The WebGL2RenderingContext.bindVertexArray() method of the WebGL 2 API binds a passed WebGLVertexArrayObject object to the buffer.

    colour: boolean

    Whether to clear the color bit

    true
    
    createVertexArray: () => WebGLVertexArrayObject

    The WebGL2RenderingContext.createVertexArray() method of the WebGL 2 API creates and initializes a WebGLVertexArrayObject object that represents a vertex array object (VAO) pointing to vertex array data and which provides names for different sets of vertex data.

    currentGeometry: string

    Stores the current geometry being rendered. Used to otimise geo rendering.

    currentProgram: number
    deleteVertexArray: (vertexArray: WebGLVertexArrayObject) => void

    The WebGL2RenderingContext.deleteVertexArray() method of the WebGL 2 API deletes a given WebGLVertexArrayObject object.

    depth: boolean

    Whether to render a depth buffer. This property is passed to the rendering context.

    true
    
    dpr: number

    The pixel aspect ratio of the renderer.

    window.devicePixelRatio or 2, whichever is smaller.
    
    drawArraysInstanced: (
        mode: number,
        first: number,
        count: number,
        instanceCound: number,
    ) => void

    The WebGL2RenderingContext.drawArraysInstanced() method of the WebGL 2 API renders primitives from array data like the gl.drawArrays() method. In addition, it can execute multiple instances of the range of elements.

    drawBuffers: (buffers: number[]) => void

    The WebGL2RenderingContext.drawBuffers() method of the WebGL 2 API defines draw buffers to which fragment colors are written into. The draw buffer settings are part of the state of the currently bound framebuffer or the drawingbuffer if no framebuffer is bound.

    drawElementsInstanced: (
        mode: number,
        count: number,
        type: number,
        offset: number,
        instanceCount: number,
    ) => void

    The WebGL2RenderingContext.drawElementsInstanced() method of the WebGL 2 API renders primitives from array data like the gl.drawElements() method. In addition, it can execute multiple instances of a set of elements.

    extensions: WTCGLExtensions

    Stores the enabled extensions

    The WTCGL rendering context.

    isWebgl2: boolean

    Whether the context we've retrieved is webGL2 or not.

    Stored device parameters such as max allowable units etc.

    premultipliedAlpha: boolean

    Whether to use premultiplied alphs. This property is passed to the rendering context.

    false
    

    The rendering state. Allows us to avoid redundant calls on methods used internally

    stencil: boolean

    Whether to render a stencil buffer. This property is passed to the rendering context.

    false
    
    vertexAttribDivisor: (index: number, divisor: number) => void

    The WebGL2RenderingContext.vertexAttribDivisor() method of the WebGL 2 API modifies the rate at which generic vertex attributes advance when rendering multiple instances of primitives with

    Accessors

    Methods

    • Binds a given WebGLFramebuffer to a target .

      Parameters

      • target: { buffer?: WebGLFramebuffer | null; target?: number } = {}

        A GLenum specifying the binding point (target). Typically only gl.FRAMEBUFFER see MDN for more information

      Returns void

    • Disables specific WebGL capabilities for this context.

      Parameters

      • id: number

        The ID of the capability to enable

      Returns void

    • Enables specific WebGL capabilities for this context. See MDN for more details

      Parameters

      • id: number

        The ID of the capability to enable

      Returns void

    • Finds and enables a webGL extension and, if it has a corresponding function, returns that.

      Parameters

      • extension: string

        The extension identifier.

      • Optionalwebgl2Func: string

        The name of the webGL2 function to return.

      • OptionalextFunc: string

        The name of the webGL1 functiont to return.

      Returns any

      • A WebGL function, bound to this renderer or null (if no function exists)
    • Retrieves the list of renderable objects sorted by position, explicit render order and applied depth

      Parameters

      • scene: { camera?: Camera; frustumCull: boolean; scene: Obj; sort: boolean }

        The root scene to render.

      Returns Drawable[]

      • An array of renderable objects
    • Sets a blending function for use in the application. See MDN for more information

      Parameters

      • modeRGB: number

        The function to be used in RGB models

      • modeAlpha: number

        The functions to be used for both RGB and alpha models

      Returns void

    • Set's various blend functions are used for blending pixel calculations See MDN for more details If alpha functions are provided, this will call gl.blendFuncSeparate, otherwise blendFunc

      Parameters

      • src: number

        A WebGL_API.Types specifying a multiplier for the RGB source blending factors.

      • dst: number

        A WebGL_API.Types specifying a multiplier for the RGB destination blending factors.

      • OptionalsrcAlpha: number

        A WebGL_API.Types specifying a multiplier for the alpha source blending factor.

      • OptionaldstAlpha: number

        A WebGL_API.Types specifying a multiplier for the alpha destination blending factor.

      Returns void

    • Set up the viewport for rendering.

      Parameters

      • dimensions: Vec2

        The dimensions of the viewport

      • position: Vec2

        The position of the viewport

      Returns void