# gl-checker-background

> checkered full-screen background for GL demos

Latest version **1.0.0** (published 2014-10-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install gl-checker-background
pnpm add gl-checker-background
yarn add gl-checker-background
bun add gl-checker-background
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2014-10-20 |
| First published | 2014-10-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Matt DesLauriers |
| Maintainers | mattdesl |
| Keywords | gl, stackgl, webgl, glsl, checker, background, photoshop, transparent, transparency, demo, quad |

## Links

- npm: https://www.npmjs.com/package/gl-checker-background
- Repository: https://github.com/mattdesl/gl-checker-background
- Issues: https://github.com/mattdesl/gl-checker-background/issues
- npm.io page: https://npm.io/package/gl-checker-background

## Dependencies (3)

- [gl-basic-shader](https://npm.io/package/gl-basic-shader.md) ^1.2.2
- [gl-sprite-batch](https://npm.io/package/gl-sprite-batch.md) ^3.0.4
- [gl-checker-texture](https://npm.io/package/gl-checker-texture.md) ^1.0.0

## Recent versions

- 1.0.0 (latest) — 2014-10-20

## README

# gl-checker-background

[![experimental](http://badges.github.io/stability-badges/dist/experimental.svg)](http://github.com/badges/stability-badges)

Draws a checkered full-screen background quad, ideal for quick demos.

![img](http://i.imgur.com/NWzvJmm.png)

```js
var createBackground = require('gl-checker-background')

var background = createBackground(gl, {
    colors: [
        [0x50,0x50,0x50,0xff],
        [0x46,0x46,0x46,0xff]
    ]
})

function render() {
    ...
    background.draw()
}
```

## Usage

[![NPM](https://nodei.co/npm/gl-checker-background.png)](https://nodei.co/npm/gl-checker-background/)


#### `bg = createBackground(gl[, opt])`

Creates a checkered background with some options.

- `shader` a shader to use, defaults to a new shader with [gl-basic-shader](https://www.npmjs.org/package/gl-basic-shader)
- `batch` a [gl-sprite-batch](https://www.npmjs.org/package/gl-sprite-batch) to use, defaults to a new one with a capacity of 1 sprite
- `colors` an array of RGBA colors (in bytes) to use for the two tones
- `size` the desired square size of the checker pixel, default `32 * devicePixelRatio`

#### `bg.draw([width, height])`

Draws the sprite as a full-screen quad, using the `width, height` to determine the repeating texture coordinates of the checker tile. Defaults to using the gl canvas width and height. 

#### `bg.dispose()`

Disposes of the texture, batch and shader associated with this background.

## License

MIT, see [LICENSE.md](http://github.com/mattdesl/gl-checker-background/blob/master/LICENSE.md) for details.

---
_Source: https://npm.io/package/gl-checker-background · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
