Skip to content

Instantly share code, notes, and snippets.

function webGLStart() {
var $id = function(d) { return document.getElementById(d); };
//Create moon
var moon = new PhiloGL.O3D.Sphere({
nlat: 30,
nlong: 30,
radius: 2,
textures: 'moon.gif',
program: 'vertex',
function webGLStart() {
var $id = function(d) { return document.getElementById(d); };
//Get Model
new PhiloGL.IO.XHR({
url: 'Teapot.json',
onSuccess: function(text) {
var json = JSON.parse(text);
json.colors = [1, 1, 1, 1];
json.textures = 'arroway.de_metal+structure+06_d100_flat.jpg';
function webGLStart() {
PhiloGL('lesson01-canvas', {
program: {
from: 'ids',
vs: 'shader-vs',
fs: 'shader-fs'
},
onError: function() {
alert("An error ocurred while loading the application");
},
function webGLStart() {
PhiloGL('lesson02-canvas', {
program: {
from: 'ids',
vs: 'shader-vs',
fs: 'shader-fs'
},
onError: function() {
alert("An error ocurred while loading the application");
},
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() {
//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,
//Add Blend Fragment Shader
PhiloGL.Shaders.Fragment.Blend = [
"#ifdef GL_ES",
"precision highp float;",
"#endif",
"varying vec4 vColor;",
"varying vec2 vTexCoord;",
"varying vec3 lightWeighting;",
//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;",
function webGLStart() {
var pos, $id = function(d) { return document.getElementById(d); };
//Create moon
var moon = new PhiloGL.O3D.Sphere({
nlat: 30,
nlong: 30,
radius: 2,
textures: 'moon.gif'
});