View Full Version : Webgl by Vertrigo

06-15-2011, 03:52 PM
Hi people, I am a beginner in WebGL, and I'm running into a problem WebGL.

After I save the code in notepad + +, I open the file through a simulation server, the vertrigo, but when I open the page, it does not work.
I'll have to buy a domain to always check the progress of my project?

I only use firefox and google chrome.


06-15-2011, 09:57 PM
You should not need a simulation server. With an html file that contains something similar to

<html lang="en"><head>
<title>gl64k - the webgl competition</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<style type="text/css">
* { margin: 0px; padding:0px; }
<canvas id="canvas"></canvas>
<script type="text/javascript" >
var gl = (function () {
var d=document, w=window, c=d.getElementById('canvas'),
gl = c.getContext('experimental-webgl');

function resize() {
c.width = w.innerWidth;
c.height = w.innerHeight;
gl.viewport(0, 0, c.width, c.height);
}; resize(); w.addEventListener('resize', resize, false);

return gl;
<script type="text/javascript" src="YOURS.js"></script>

and webgl in the file YOURS.js you should be able to test using a file path URL in Chrome. No need for a server simulator unless you code needs server support.

Your file path URL will look something like

There is nothing special about the name YOURS.js and you can modularize your code
by including multiple such lines.

06-16-2011, 06:25 AM
It's Work! Thanks