@vaalentin/gl-texture-display

Display a WebGL texture. Usefull to display the content of a fbo.

Usage no npm install needed!

<script type="module">
  import vaalentinGlTextureDisplay from 'https://cdn.skypack.dev/@vaalentin/gl-texture-display';
</script>

README

GL Texture display

Display a WebGL texture. Usefull to display the content of a fbo.

Installation

$ npm install --save @vaalentin/gl-texture-display

Usage

import TextureDisplay from '@vaalentin/gl-texture-display';

// set gl and texture

const display = new TextureDisplay(gl, texture);

// then in the render loop
display.render();

API

display = new TextureDisplay(gl, texture [, width, height, left, top])

Create a new instance, where:

  • gl is the WebGL context.
  • texture is a Texture
  • width (default 0.25), height (default 0.25), left (default 0.75) and top (default 0) are all normalized values (1 being fullscreen).

display.render([unit])

Render using the given unit (default is 0).

display.dispose()

Delete instance. Let the texture intact.

License

MIT, see LICENSE.md for more details.