JSFiddle - React, Tailwind, and code Playground

by Ilya Karpuk

HTML

<canvas id="canvas"></canvas>

JavaScript

// WebGL
var GLIDE = { VERSION: "0.1" };

GLIDE.prototype.Create = function ( container, props ){

	var clearColor = props.clearColor !== undefined ? props.clearColor : new GLIDE.Color( 0, 0, 0 );

	initGL( container );
  initShaders();
  initBuffer();
 
	gl.clearColor( clearColor.r, clearColor.g, clearColor.b, clearColor.a );
  gl.clearDepth( 1 );
	gl.enable( gl.DEPTH_TEST );
  gl.depthFunc( gl.LEQUAL );
  
}

GLIDE.prototype.Color = function ( r, g, b, a ){
	
  if (typeof r == 'number' && typeof g == 'number' && typeof b == 'number') {
  	this.r = r, this.g = this.g, this.b = b;
    if (typeof a == 'number'){
    	this.a = a;
    } else {
    	this.a = 1;
    }
  }
  
}