How to use gl-matrix-mat4 - 3 common examples

To help you get started, we’ve selected a few gl-matrix-mat4 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tmpvar / gl-ttf / demo / demo-3d.js View on Github external
var createWebGLContext = require('fc');
var glslify            = require('glslify')
var createGLClear      = require('gl-clear');
var createGeometry     = require('gl-geometry');
var createCamera       = require('orbit-camera');
var computeNormal      = require('triangle-normal');
var mat4               = require('gl-matrix-mat4');

var createFont         = require('../gl-ttf');


var m4scratch = mat4.create();

var camera = createCamera(
  [10, 0, 10],
  [0, 0, 0],
  [0, 1, 0]
);

camera.distance = 10;


var gl = createWebGLContext(render, true, 3);
var clear = createGLClear({
  color: [0.043, 0.043, .086, 1.0]
}).bind(null, gl);

var shader = glslify({
github tmpvar / gl-ttf / demo / demo-3d.js View on Github external
function render() {
  gl.viewport(0, 0, gl.canvas.width, gl.canvas.height);
  gl.enable(gl.DEPTH_TEST);
  clear();


  characterPos = [0, 0, 0];
  shader.bind();

  shader.uniforms.unitsPerEm = unitsPerEm;
  shader.uniforms.model = mat4.identity(m4scratch);
  shader.uniforms.projection = mat4.perspective(
    m4scratch,
    Math.PI/4,
    gl.canvas.width/gl.canvas.height,
    0.1,
    1000.00
  );

  shader.uniforms.view = camera.view(m4scratch);
  var now = Date.now();

  letters.forEach(function(letter) {
    letter.geometry.bind(shader);
    shader.uniforms.characterPos = characterPos;
    shader.uniforms.time = now - start;
    letter.geometry.draw(gl.TRIANGLES);
github tmpvar / gl-ttf / demo / demo-3d.js View on Github external
function render() {
  gl.viewport(0, 0, gl.canvas.width, gl.canvas.height);
  gl.enable(gl.DEPTH_TEST);
  clear();


  characterPos = [0, 0, 0];
  shader.bind();

  shader.uniforms.unitsPerEm = unitsPerEm;
  shader.uniforms.model = mat4.identity(m4scratch);
  shader.uniforms.projection = mat4.perspective(
    m4scratch,
    Math.PI/4,
    gl.canvas.width/gl.canvas.height,
    0.1,
    1000.00
  );

  shader.uniforms.view = camera.view(m4scratch);
  var now = Date.now();

  letters.forEach(function(letter) {
    letter.geometry.bind(shader);
    shader.uniforms.characterPos = characterPos;
    shader.uniforms.time = now - start;
    letter.geometry.draw(gl.TRIANGLES);
    letter.geometry.bind(shader);

gl-matrix-mat4

Standalone Matrix4 component of gl-matrix

MIT
Latest version published 10 years ago

Package Health Score

60 / 100
Full package analysis

Similar packages