PDA

View Full Version : Webgl by Vertrigo



Jimdavis10
06-15-2011, 02: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.

Thanks

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


<!DOCTYPE HTML>
<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; }
</style>
</head><body>
<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>
<script type="text/javascript" src="YOURS.js"></script>
</body></html>

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
file:///C:/test/webgl/index.html

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

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