import _gl from 'webgl' ; declare var window ; export default class Canvas extends _gl implements WebGLRenderingContext { canvas : HTMLCanvasElement ; constructor ( ) { _gl . init ( ) ; this . canvas = < HTMLCanvasElement > < any > this ; } get drawingBufferWidth ( ) : number { return window . innerWidth ; } get drawingBufferHeight ( ) : number { return window . innerHeight ; } get clientWidth ( ) : number { return window . innerWidth ; } get clientHeight ( ) : number { return window . innerHeight ; } getBoundingClientRect ( ) { return { bottom : window . innerHeight , height : window . innerHeight , left : 0 , right : window . innerWidth , top : 0 , width : window . innerWidth } ; } public getContext ( name , options ) { if ( name === 'webgl2' ) { return this ; } return null ; } focus ( ) { window . focus ( ) ; } addEventListener ( eventName , cb , flag ) { window . addEventListener ( eventName , cb , flag ) ; } removeEventListener ( eventName , cb ) { window . removeEventListener ( eventName , cb ) ; } drawArraysInstanced ( mode , first , count , primcount ) { throw new Error ( 'Method not implemented.' ) ; } drawElementsInstanced ( mode , count , type , offset , primcount ) { throw new Error ( 'Method not implemented.' ) ; } vertexAttribDivisor ( index , divisor ) { throw new Error ( 'Method not implemented.' ) ; } createVertexArray ( ) { const val = _gl . createVertexArray ( ) ; if ( val >= 0 ) { return < WebGLVertexArrayObject > { value : val } ; } return null ; } bindVertexArray ( vao ? ) { _gl . bindVertexArray ( vao ? ( < any > vao ) . value : 0 ) ; } deleteVertexArray ( vao ) { throw new Error ( 'Method not implemented.' ) ; } blitFramebuffer ( srcX0 , srcY0 , srcX1 , srcY1 , dstX0 , dstY0 , dstX1 , dstY1 , mask , filter ) { throw new Error ( 'Method not implemented.' ) ; } renderbufferStorageMultisample ( target , samples , internalformat , width , height ) { throw new Error ( 'Method not implemented.' ) ; } bindBufferBase ( target , index , buffer ) { _gl . bindBufferBase ( target , index , buffer ? ( < any > buffer ) . value : 0 ) ; } getUniformBlockIndex ( program , uniformBlockName ) { return _gl . getUniformBlockIndex ( program ? ( < any > program ) . value : 0 , uniformBlockName ) ; } uniformBlockBinding ( program , uniformBlockIndex , uniformBlockBindingValue ) { _gl . uniformBlockBinding ( program ? ( < any > program ) . value : 0 , uniformBlockIndex , uniformBlockBindingValue ) ; } createQuery ( ) { throw new Error ( 'Method not implemented.' ) ; } deleteQuery ( query ) { throw new Error ( 'Method not implemented.' ) ; } beginQuery ( target , query ) { throw new Error ( 'Method not implemented.' ) ; } endQuery ( target ) { throw new Error ( 'Method not implemented.' ) ; } getQueryParameter ( query , pname ) { throw new Error ( 'Method not implemented.' ) ; } getQuery ( target , pname ) { throw new Error ( 'Method not implemented.' ) ; } drawBuffers ( buffers ) { throw new Error ( 'Method not implemented.' ) ; } readBuffer ( src ) { throw new Error ( 'Method not implemented.' ) ; } texImage3D ( target , level , internalformat , width , height , depth , border , format , type , pixels , offset ? ) ; texImage3D ( target , level , internalformat , width , height , depth , border , format , type , pixels ) ; texImage3D ( target , level , internalformat , width , height , depth , border , format , type , pixels , offset ? ) { throw new Error ( 'Method not implemented.' ) ; } compressedTexImage3D ( target , level , internalformat , width , height , depth , border , data , offset ? , length ? ) { throw new Error ( 'Method not implemented.' ) ; } createTransformFeedback ( ) { throw new Error ( 'Method not implemented.' ) ; } deleteTransformFeedback ( transformFeedbac ) { throw new Error ( 'Method not implemented.' ) ; } bindTransformFeedback ( target , transformFeedback ) { throw new Error ( 'Method not implemented.' ) ; } beginTransformFeedback ( primitiveMode ) { throw new Error ( 'Method not implemented.' ) ; } endTransformFeedback ( ) { throw new Error ( 'Method not implemented.' ) ; } transformFeedbackVaryings ( program , varyings , bufferMode ) { throw new Error ( 'Method not implemented.' ) ; } clearBufferfv ( buffer , drawbuffer , values , srcOffset ) { throw new Error ( 'Method not implemented.' ) ; } clearBufferiv ( buffer , drawbuffer , values , srcOffset ) { throw new Error ( 'Method not implemented.' ) ; } clearBufferuiv ( buffer , drawbuffer , values , srcOffset ) { throw new Error ( 'Method not implemented.' ) ; } clearBufferfi ( buffer , drawbuffer , depth , stencil ) { throw new Error ( 'Method not implemented.' ) ; } activeTexture ( texture ) { _gl . activeTexture ( texture ) ; } attachShader ( program , shader ) { _gl . attachShader ( program ? ( < any > program ) . value : 0 , shader ? ( < any > shader ) . value : 0 ) ; } bindAttribLocation ( program , index , name ) { throw new Error ( 'Method not implemented.' ) ; } bindBuffer ( target , buffer ) { _gl . bindBuffer ( target , buffer ? ( < any > buffer ) . value : 0 ) ; } bindFramebuffer ( target , framebuffer ) { _gl . bindFramebuffer ( target , framebuffer ? ( < any > framebuffer ) . value : 0 ) ; } bindRenderbuffer ( target , renderbuffer ) { _gl . bindRenderbuffer ( target , renderbuffer ? ( < any > renderbuffer ) . value : 0 ) ; } bindTexture ( target , texture ) { _gl . bindTexture ( target , texture ? ( < any > texture ) . value : 0 ) ; } blendColor ( red , green , blue , alpha ) { throw new Error ( 'Method not implemented.' ) ; } blendEquation ( mode ) { throw new Error ( 'Method not implemented.' ) ; } blendEquationSeparate ( modeRGB , modeAlpha ) { throw new Error ( 'Method not implemented.' ) ; } blendFunc ( sfactor , dfactor ) { throw new Error ( 'Method not implemented.' ) ; } blendFuncSeparate ( srcRGB , dstRGB , srcAlpha , dstAlpha ) { _gl . blendFuncSeparate ( srcRGB , dstRGB , srcAlpha , dstAlpha ) ; } bufferData ( target , sizeOrData , usage ) ; bufferData ( target , data , usage ) { _gl . bufferData ( target , data . buffer . bufferNativeInstance , usage ) ; } bufferSubData ( target , offset , data ) { _gl . bufferSubData ( target , offset , ( < any > data ) . buffer . bufferNativeInstance ) ; } checkFramebufferStatus ( target ) { throw new Error ( 'Method not implemented.' ) ; } clear ( mask ) { _gl . clear ( mask ) ; } clearColor ( red , green , blue , alpha ) { _gl . clearColor ( red , green , blue , alpha ) ; } clearDepth ( depth ) { _gl . clearDepth ( depth ) ; } clearStencil ( s ) { _gl . clearStencil ( s ) ; } colorMask ( red , green , blue , alpha ) { throw new Error ( 'Method not implemented.' ) ; } compileShader ( shader ) { _gl . compileShader ( ( < any > shader ) . value ) ; } compressedTexImage2D ( target , level , internalformat , width , height , border , data ) { throw new Error ( 'Method not implemented.' ) ; } compressedTexSubImage2D ( target , level , xoffset , yoffset , width , height , format , data ) { throw new Error ( 'Method not implemented.' ) ; } copyTexImage2D ( target , level , internalformat , x , y , width , height , border ) { _gl . copyTexImage2D ( target , level , internalformat , x , y , width , height , border ) ; } copyTexSubImage2D ( target , level , xoffset , yoffset , x , y , width , height ) { throw new Error ( 'Method not implemented.' ) ; } createBuffer ( ) { const val = _gl . createBuffer ( ) ; if ( val >= 0 ) { return < WebGLBuffer > < any > { value : val } ; } return null ; } createFramebuffer ( ) { const val = _gl . createFramebuffer ( ) ; if ( val >= 0 ) { return < WebGLBuffer > < any > { value : val } ; } return null ; } createProgram ( ) { const val = _gl . createProgram ( ) ; if ( val >= 0 ) { return < WebGLProgram > { value : val } ; } return null ; } createRenderbuffer ( ) { const val = _gl . createRenderbuffer ( ) ; if ( val >= 0 ) { return < WebGLRenderbuffer > { value : val } ; } return null ; } createShader ( type ) { const val = _gl . createShader ( type ) ; if ( val >= 0 ) { return < WebGLShader > { value : val , type : type } ; } return null ; } createTexture ( ) { const val = _gl . createTexture ( ) ; if ( val >= 0 ) { return < WebGLShader > { value : val } ; } return null ; } cullFace ( mode ) { _gl . cullFace ( mode ) ; } deleteBuffer ( buffer ) { throw new Error ( 'Method not implemented.' ) ; } deleteFramebuffer ( framebuffer ) { _gl . deleteFramebuffer ( framebuffer ? ( < any > framebuffer ) . value : 0 ) ; } deleteProgram ( program ) { _gl . deleteProgram ( program ? ( < any > program ) . value : 0 ) ; } deleteRenderbuffer ( renderbuffer ) { _gl . deleteRenderbuffer ( renderbuffer ? ( < any > renderbuffer ) . value : 0 ) ; } deleteShader ( shader ) { _gl . deleteShader ( shader ? ( < any > shader ) . value : 0 ) ; } deleteTexture ( texture ) { _gl . deleteTexture ( texture ? ( < any > texture ) . value : 0 ) ; } depthFunc ( func ) { _gl . depthFunc ( func ) ; } depthMask ( flag ) { _gl . depthMask ( flag ) ; } depthRange ( zNear , zFar ) { throw new Error ( 'Method not implemented.' ) ; } detachShader ( program , shader ) { throw new Error ( 'Method not implemented.' ) ; } disable ( cap ) { _gl . disable ( cap ) ; } disableVertexAttribArray ( index ) { _gl . disableVertexAttribArray ( index ) ; } drawArrays ( mode , first , count ) { _gl . drawArrays ( mode , first , count ) ; } drawElements ( mode , count , type , offset ) { _gl . drawElements ( mode , count , type , offset ) ; } enable ( cap ) { _gl . enable ( cap ) ; } enableVertexAttribArray ( index ) { _gl . enableVertexAttribArray ( index ) ; } finish ( ) { throw new Error ( 'Method not implemented.' ) ; } flush ( ) { _gl . flush ( ) ; } framebufferRenderbuffer ( target , attachment , renderbuffertarget , renderbuffer ) { _gl . framebufferRenderbuffer ( target , attachment , renderbuffertarget , renderbuffer ? ( < any > renderbuffer ) . value : 0 ) ; } framebufferTexture2D ( target , attachment , textarget , texture , level ) { _gl . framebufferTexture2D ( target , attachment , textarget , texture ? ( < any > texture ) . value : 0 , level ) ; } frontFace ( mode ) { _gl . frontFace ( mode ) ; } generateMipmap ( target ) { _gl . generateMipmap ( target ) ; } getActiveAttrib ( program , index ) { throw new Error ( 'Method not implemented.' ) ; } getActiveUniform ( program , index ) { throw new Error ( 'Method not implemented.' ) ; } getAttachedShaders ( program ) { throw new Error ( 'Method not implemented.' ) ; } getAttribLocation ( program , name ) { return _gl . getAttribLocation ( program ? ( < any > program ) . value : 0 , name ) ; } getBufferParameter ( target , pname ) { throw new Error ( 'Method not implemented.' ) ; } getContextAttributes ( ) { return undefined ; } getError ( ) { return _gl . error ( ) ; } getExtension ( extensionName ) ; getExtension ( extensionName ) ; getExtension ( extensionName ) ; getExtension ( extensionName ) ; getExtension ( extensionName ) ; getExtension ( extensionName ) ; getExtension ( extensionName ) ; getExtension ( extensionName ) ; getExtension ( extensionName ) ; getExtension ( extensionName ) ; getExtension ( extensionName ) ; getExtension ( extensionName ) ; getExtension ( extensionName ) ; getExtension ( extensionName ) ; getExtension ( extensionName ) ; getExtension ( extensionName ) ; getExtension ( extensionName ) ; getExtension ( extensionName ) ; getExtension ( extensionName ) ; getExtension ( extensionName ) ; getExtension ( extensionName ) ; getExtension ( extensionName ) ; getExtension ( extensionName ) { return null ; } getFramebufferAttachmentParameter ( target , attachment , pname ) { throw new Error ( 'Method not implemented.' ) ; } getParameter ( pname ) { return _gl . getParameter ( pname ) ; } getProgramInfoLog ( program ) { return _gl . getProgramInfoLog ( program ? ( < any > program ) . value : 0 ) ; } getProgramParameter ( program , pname ) { return _gl . getProgramParameter ( program ? ( < any > program ) . value : 0 , pname ) ; } getRenderbufferParameter ( target , pname ) { throw new Error ( 'Method not implemented.' ) ; } getShaderInfoLog ( shader ) { return _gl . getShaderInfoLog ( shader ? ( < any > shader ) . value : 0 ) ; } getShaderParameter ( shader , pname ) { return _gl . getShaderParameter ( shader ? ( < any > shader ) . value : 0 , pname ) ; } getShaderPrecisionFormat ( shadertype , precisiontype ) { return _gl . getShaderPrecisionFormat ( shadertype , precisiontype ) ; } getShaderSource ( shader ) { throw new Error ( 'Method not implemented.' ) ; } getSupportedExtensions ( ) { throw new Error ( 'Method not implemented.' ) ; } getTexParameter ( target , pname ) { throw new Error ( 'Method not implemented.' ) ; } getUniform ( program , location ) { throw new Error ( 'Method not implemented.' ) ; } getUniformLocation ( program , name ) { const val = _gl . getUniformLocation ( program ? ( < any > program ) . value : 0 , name ) ; if ( val >= 0 ) { return < WebGLUniformLocation > { value : val , name : name } ; } return null ; } getVertexAttrib ( index , pname ) { throw new Error ( 'Method not implemented.' ) ; } getVertexAttribOffset ( index , pname ) { throw new Error ( 'Method not implemented.' ) ; } hint ( target , mode ) { throw new Error ( 'Method not implemented.' ) ; } isBuffer ( buffer ) { throw new Error ( 'Method not implemented.' ) ; } isContextLost ( ) { throw new Error ( 'Method not implemented.' ) ; } isEnabled ( cap ) { throw new Error ( 'Method not implemented.' ) ; } isFramebuffer ( framebuffer ) { throw new Error ( 'Method not implemented.' ) ; } isProgram ( program ) { throw new Error ( 'Method not implemented.' ) ; } isRenderbuffer ( renderbuffer ) { throw new Error ( 'Method not implemented.' ) ; } isShader ( shader ) { throw new Error ( 'Method not implemented.' ) ; } isTexture ( texture ) { throw new Error ( 'Method not implemented.' ) ; } lineWidth ( width ) { throw new Error ( 'Method not implemented.' ) ; } linkProgram ( program ) { _gl . linkProgram ( program ? ( < any > program ) . value : 0 ) ; } pixelStorei ( pname , param ) { if ( pname == undefined ) { return ; } _gl . pixelStorei ( pname , param ) ; } polygonOffset ( factor , units ) { throw new Error ( 'Method not implemented.' ) ; } readPixels ( x , y , width , height , format , type , pixels ) { throw new Error ( 'Method not implemented.' ) ; } renderbufferStorage ( target , internalformat , width , height ) { _gl . renderbufferStorage ( target , internalformat , width , height ) ; } sampleCoverage ( value , invert ) { throw new Error ( 'Method not implemented.' ) ; } scissor ( x , y , width , height ) { throw new Error ( 'Method not implemented.' ) ; } shaderSource ( shader , source ) { const newSource = source . replace ( '#version 300 es' , '#version 440' ) ; _gl . shaderSource ( shader ? ( < any > shader ) . value : 0 , newSource ) ; } stencilFunc ( func , ref , mask ) { _gl . stencilFunc ( func , ref , mask ) ; } stencilFuncSeparate ( face , func , ref , mask ) { throw new Error ( 'Method not implemented.' ) ; } stencilMask ( mask ) { _gl . stencilMask ( mask ) ; } stencilMaskSeparate ( face , mask ) { throw new Error ( 'Method not implemented.' ) ; } stencilOp ( fail , zfail , zpass ) { _gl . stencilOp ( fail , zfail , zpass ) ; } stencilOpSeparate ( face , fail , zfail , zpass ) { throw new Error ( 'Method not implemented.' ) ; } texImage2D ( target , level , internalformat , width , height , border , format , type , pixels ) ; texImage2D ( target , level , internalformat , format , type , source ) ; texImage2D ( target , level , internalformat , width , height , border , format ? , type ? , pixels ? ) { if ( format ) { _gl . texImage2D ( target , level , internalformat , width , height , border , format , type , pixels ? ( < any > pixels ) . buffer . bufferNativeInstance : null ) ; } else { _gl . texImage2D ( target , level , internalformat , border . width , border . height , 0 , width , height , border . bits ) ; } } texParameterf ( target , pname , param ) { throw new Error ( 'Method not implemented.' ) ; } texParameteri ( target , pname , param ) { _gl . texParameteri ( target , pname , param ) ; } texSubImage2D ( target , level , xoffset , yoffset , width , height , format , type , pixels ) ; texSubImage2D ( target , level , xoffset , yoffset , format , type , source ) ; texSubImage2D ( target , level , xoffset , yoffset , width , height , format , type ? , pixels ? ) { throw new Error ( 'Method not implemented.' ) ; } uniform1f ( location , x ) { _gl . uniform1f ( location ? ( < any > location ) . value : 0 , x ) ; } uniform1fv ( location , v ) { _gl . uniform1fv ( location ? ( < any > location ) . value : 0 , ( < any > v ) . buffer . bufferNativeInstance ) ; } uniform1i ( location , x ) { _gl . uniform1i ( location ? ( < any > location ) . value : 0 , x ) ; } uniform1iv ( location , v ) { _gl . uniform1iv ( location ? ( < any > location ) . value : 0 , ( < any > v ) . buffer . bufferNativeInstance ) ; } uniform2f ( location , x , y ) { _gl . uniform2f ( location ? ( < any > location ) . value : 0 , x , y ) ; } uniform2fv ( location , v ) { _gl . uniform2fv ( location ? ( < any > location ) . value : 0 , ( < any > v ) . buffer . bufferNativeInstance ) ; } uniform2i ( location , x , y ) { _gl . uniform2i ( location ? ( < any > location ) . value : 0 , x , y ) ; } uniform2iv ( location , v ) { _gl . uniform2iv ( location ? ( < any > location ) . value : 0 , ( < any > v ) . buffer . bufferNativeInstance ) ; } uniform3f ( location , x , y , z ) { _gl . uniform3f ( location ? ( < any > location ) . value : 0 , x , y , z ) ; } uniform3fv ( location , v ) { _gl . uniform3fv ( location ? ( < any > location ) . value : 0 , ( < any > v ) . buffer . bufferNativeInstance ) ; } uniform3i ( location , x , y , z ) { _gl . uniform3i ( location ? ( < any > location ) . value : 0 , x , y , z ) ; } uniform3iv ( location , v ) { _gl . uniform3iv ( location ? ( < any > location ) . value : 0 , ( < any > v ) . buffer . bufferNativeInstance ) ; } uniform4f ( location , x , y , z , w ) { _gl . uniform4f ( location ? ( < any > location ) . value : 0 , x , y , z , w ) ; } uniform4fv ( location , v ) { _gl . uniform4fv ( location ? ( < any > location ) . value : 0 , ( < any > v ) . buffer . bufferNativeInstance ) ; } uniform4i ( location , x , y , z , w ) { _gl . uniform4i ( location ? ( < any > location ) . value : 0 , x , y , z , w ) ; } uniform4iv ( location , v ) { _gl . uniform4iv ( location ? ( < any > location ) . value : 0 , ( < any > v ) . buffer . bufferNativeInstance ) ; } uniformMatrix2fv ( location , transpose , value ) { _gl . uniformMatrix2fv ( location ? ( < any > location ) . value : 0 , transpose , ( < any > value ) . buffer . bufferNativeInstance ) ; } uniformMatrix3fv ( location , transpose , value ) { _gl . uniformMatrix3fv ( location ? ( < any > location ) . value : 0 , transpose , ( < any > value ) . buffer . bufferNativeInstance ) ; } uniformMatrix4fv ( location , transpose , value ) { _gl . uniformMatrix4fv ( location ? ( < any > location ) . value : 0 , transpose , ( < any > value ) . buffer . bufferNativeInstance ) ; } useProgram ( program ) { _gl . useProgram ( program ? ( < any > program ) . value : 0 ) ; } validateProgram ( program ) { _gl . validateProgram ( program ? ( < any > program ) . value : 0 ) ; } vertexAttrib1f ( index , x ) { throw new Error ( 'Method not implemented.' ) ; } vertexAttrib1fv ( index , values ) { throw new Error ( 'Method not implemented.' ) ; } vertexAttrib2f ( index , x , y ) { throw new Error ( 'Method not implemented.' ) ; } vertexAttrib2fv ( index , values ) { throw new Error ( 'Method not implemented.' ) ; } vertexAttrib3f ( index , x , y , z ) { throw new Error ( 'Method not implemented.' ) ; } vertexAttrib3fv ( index , values ) { throw new Error ( 'Method not implemented.' ) ; } vertexAttrib4f ( index , x , y , z , w ) { throw new Error ( 'Method not implemented.' ) ; } vertexAttrib4fv ( index , values ) { throw new Error ( 'Method not implemented.' ) ; } vertexAttribPointer ( index , size , type , normalized , stride , offset ) { _gl . vertexAttribPointer ( index , size , type , normalized , stride , offset ) ; } viewport ( x , y , width , height ) { _gl . viewport ( x , y , width , height ) ; } }