Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gl-cube

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gl-cube

gl-cube build on stack.gl

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
increased by66.67%
Maintainers
1
Weekly downloads
 
Created
Source

gl-cube

Generate all you need to build an webgl cube based on stack.gl

example

how to use


var createCube = require("gl-cube");
var cube = createCube(
	gl,
	{
		dimension: {x: 2.0, y: 5.0, z: 2.0},
		position: {x: 3.5, y: 0.0, z: -9.0},
		rotation: {x: 0, y: Math.PI / 2, z: 0},
		color: {r: 0.8, g: 0.1, b: 0.2, a: 1.0}
	}
);


/*In your render method*/
render() {
	/*......*/
	shader.uniforms.uModelView = cube.matrix;
	cube.vertices.bind();
	shader.attributes.aPosition.pointer();
	cube.colors.bind();
	shader.attributes.aColor.pointer();
	cube.normals.bind();
	shader.attributes.aNormal.pointer();
	cube.indices.bind();
	gl.drawElements(gl.TRIANGLES, cube.length, gl.UNSIGNED_SHORT, 0);
	/*......*/
}

how to run demo

npm install
npm run start-example

After running npm start, a wzrd server should start running on http://localhost:9966/ Enjoy!

FAQs

Package last updated on 24 Jul 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc