npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

gl-texture-cube

v1.0.1

Published

Wraps WebGL's cube texture object.

Readme

gl-texture-cube

Wraps WebGL's cube texture object.

Note: This API is experimental and will probably change to reach parity with gl-texture2d.

Install

npm install gl-texture-cube

Example

Javascript

var Box3D = require('geo-3d-box')
var TextureCube = require('gl-texture-cube')

var boxData = Box3D({size: 2})

var box = Geometry(gl)
  .attr('aPosition', boxData.positions)
  .faces(boxData.cells)

var textures = generateCubemapTextures()

var cubemap = TextureCube(gl, textures)

program.uniforms.uTexture = cubemap.bind(0)
program.uniforms.uModel = model
program.uniforms.uView = view
program.uniforms.uProjection = projection

box.draw()

Vertex Shader

attribute vec3 aPosition;

uniform mat4 uModel;
uniform mat4 uView;
uniform mat4 uProjection;

varying vec3 vNorm;

void main() {
    gl_Position = uProjection * uView * uModel * vec4(aPosition, 1.0);
    vNorm = aPosition;
}

Fragment Shader

uniform samplerCube uTexture;

varying vec3 vNorm;

void main() {
    gl_FragColor = textureCube(uTexture, vNorm);
}

API

var createTextureCube = require('gl-texture-cube')

Constructor

var cubemap = createTextureCube(gl, domElements[, format=gl.RGBA, type=gl.UNSIGNED_BYTE])

Creates a texture from domElements, structured as:

{
  pos: {
    x: domElement,
    y: domElement,
    z: domElement,
  },
  neg: {
    x: domElement,
    y: domElement,
    z: domElement
  }
}

...where each domElement can be one of:

  • An ImageData object
  • An HTMLCanvas object
  • An HTMLImage object
  • An HTMLVideo object

Takes a WebGL context gl. Optionally takes a WebGL data format format and storage type type.

Methods

cubemap.bind([textureUnit])

Binds the texture. If the optional textureUnit is not defined then the active texture is not changed.

cubemap.dispose()

Destroys the texture and releases its resources.

cubemap.generateMipmap()

Generates mipmaps for the texture.

Properties

cubemap.wrap

Gets/sets the wrap behavior for the texture in both dimensions. Defaults to [gl.CLAMP_TO_EDGE, gl.CLAMP_TO_EDGE]. Example:

cubemap.wrap = [gl.REPEAT, gl.REPEAT]

cubemap.magFilter & cubemap.minFilter

Gets/sets the magnification and minification filter. Defaults to gl.NEAREST.

Credits

Based on gl-texture2d.