import Buffer from "./Buffer" ; /**
 * Rendering Context wraps WebGLRenderingContext and
 * a cache for shared Buffers.
 */ export default class RenderingContext { private buffers : { [ name ] : Buffer ; } = { } ; param gl constructor ( private gl ) { } /**
     * Returns the WebGLRenderingContext
     */ public getGl ( ) { return this . gl ; } param name param buffer public cacheBuffer ( name , buffer ) { this . buffers [ name ] = buffer ; } param name public getBuffer ( name ) { return this . buffers [ name ] ; } public destroy ( ) { for ( const bufName in this . buffers ) { if ( ! this . buffers . hasOwnProperty ( bufName ) ) { continue ; } this . buffers [ bufName ] . destroy ( ) ; } } }