Skip to content

Instantly share code, notes, and snippets.

PhiloGL.unpack();
function webGLStart() {
var pitch = 0,
pitchRate = 0,
yaw = 0,
yawRate = 0,
xPos = 0,
yPos = 0.4,
zPos = 0,
speed = 0,
//Add Uniform Color Fragment Shader
PhiloGL.Shaders.Fragment.ColorUniform = [
"#ifdef GL_ES",
"precision highp float;",
"#endif",
"varying vec4 vColor;",
"varying vec2 vTexCoord;",
"varying vec3 lightWeighting;",
//Add Blend Fragment Shader
PhiloGL.Shaders.Fragment.Blend = [
"#ifdef GL_ES",
"precision highp float;",
"#endif",
"varying vec4 vColor;",
"varying vec2 vTexCoord;",
"varying vec3 lightWeighting;",
//Lighting form elements variables
var $id = function(d) { return document.getElementById(d); };
function webGLStart() {
var xRot = 0, xSpeed = 0,
yRot = 0, ySpeed = 0,
z = -5.0;
//Get lighting form elements
var lighting = $id('lighting'),
function webGLStart() {
var xRot = 0, xSpeed = 0,
yRot = 0, ySpeed = 0,
z = -5.0,
filter = 0,
filters = ['nearest', 'linear', 'mipmap'];
//Create object
var cube = new PhiloGL.O3D.Model({
vertices: [-1, -1, 1,
function webGLStart() {
//Create object
var cube = new PhiloGL.O3D.Model({
texture: 'nehe.gif',
vertices: [-1, -1, 1,
1, -1, 1,
1, 1, 1,
-1, 1, 1,
function webGLStart() {
//Create object
var cube = new PhiloGL.O3D.Model({
texture: 'nehe.gif',
vertices: [[-1, -1, 1],
[ 1, -1, 1],
[ 1, 1, 1],
[-1, 1, 1],
function webGLStart() {
//Load models
var pyramid = new PhiloGL.O3D.Model({
vertices: [ 0, 1, 0,
-1, -1, 1,
1, -1, 1,
0, 1, 0,
1, -1, 1,
1, -1, -1,
0, 1, 0,
function webGLStart() {
//Load models
var triangle = new PhiloGL.O3D.Model({
vertices: [ 0, 1, 0,
-1, -1, 0,
1, -1, 0],
colors: [1, 0, 0, 1,
0, 1, 0, 1,
0, 0, 1, 1]
function webGLStart() {
PhiloGL('lesson02-canvas', {
program: {
from: 'ids',
vs: 'shader-vs',
fs: 'shader-fs'
},
onError: function() {
alert("An error ocurred while loading the application");
},