Created
August 5, 2011 17:22
-
-
Save philogb/1128029 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
//Unpack PhiloGL modules | |
PhiloGL.unpack(); | |
var plane = new O3D.Plane({ | |
type: 'x,y', | |
xlen: 2, | |
ylen: 2, | |
offset: 1, | |
program: 'quat', | |
colors: [0, 0, 0, 1] | |
}); | |
window.init = function() { | |
//Create App | |
PhiloGL('canvas', { | |
program: [{ | |
id: 'quat', | |
from: 'uris', | |
vs: 'surface.vs.glsl', | |
fs: 'surface.fs.glsl', | |
noCache: true | |
}], | |
camera: { | |
position: { | |
fov: 45, | |
x: 0, y: 0, z: 1 | |
} | |
}, | |
onError: function() { | |
alert("There was an error while creating the WebGL application"); | |
}, | |
onLoad:function application(app) { | |
var gl = app.gl, | |
canvas = gl.canvas, | |
scene = app.scene, | |
camera = app.camera, | |
program = app.program, | |
gl.viewport(0, 0, canvas.width, canvas.height); | |
gl.clearColor(0, 0, 0, 1); | |
//Add plane | |
scene.add(plane); | |
//run loop | |
render(); | |
//Render the scene and perform a new loop | |
function render() { | |
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); | |
scene.render(); | |
Fx.requestAnimationFrame(render); | |
} | |
} | |
}); | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nvm, found it: https://github.com/philogb/philogl/blob/master/examples/quaternion/index.js