Skip to content

Instantly share code, notes, and snippets.

@philogb
Created August 5, 2011 17:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save philogb/1128029 to your computer and use it in GitHub Desktop.
Save philogb/1128029 to your computer and use it in GitHub Desktop.
(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);
}
}
});
};
})();
@drewwells
Copy link

Do you have the complete example for this on gist? Perhaps with vertex/fragment shaders?

@drewwells
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment