I try to use the philogl library, and when I wrote,
<!DOCTYPE html> <html> <head> <title>PGL2</title> <script type="text/javascript" src="PhiloGL.js"></script> <script type="text/javascript"> function webGLStart(){ alert('I m alive'); } </script> </head> <body onload="webGLStart();"> <canvas id="c" style="width:500px; height:500px;"></canvas> </body> </html>
everything works fine, but if I write some kind of philologist in it, for example,
<!DOCTYPE html> <html> <head> <title>PGL2</title> <script type="text/javascript" src="PhiloGL.js"></script> <script type="text/javascript"> function webGLStart(){ var triangle = new PhiloGL.O3D.Model({ vertices: [[0,1,0],[-1,-1,0],[1,-1,0]], colors: [[1,0,0,1],[0,1,0,1],[0,0,1,1]] }); var square = new PhiloGL.O3D.Model({ vertices: [[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0]], colors: [[0.5,0.5,1,1],[0.5,0.5,1,1]],[0.5,0.5,1,1] }); } </script> </head> <body onload="webGLStart();"> <canvas id="c" style="width:500px; height:500px;"></canvas> </body> </html>
chrome and firefox give me an error that says webGLStart () is not defined. What is wrong with my code?