";
+ alert( msg );
+ return -1;
+ }
+ }
+
+ var program = gl.createProgram();
+ gl.attachShader( program, vertShdr );
+ gl.attachShader( program, fragShdr );
+ gl.linkProgram( program );
+
+ if ( !gl.getProgramParameter(program, gl.LINK_STATUS) ) {
+ var msg = "Shader program failed to link. The error log is:"
+ + "
" + gl.getProgramInfoLog( program ) + "
";
+ alert( msg );
+ return -1;
+ }
+
+ return program;
+}
diff --git a/javascripts/application.js b/javascripts/application.js
deleted file mode 100644
index 613bddb..0000000
--- a/javascripts/application.js
+++ /dev/null
@@ -1,41 +0,0 @@
-var gl; // A global variable for the WebGL context
-
-// The initWebGL function
-function initWebGL(canvas) {
- gl = null;
-
- // Try to grab the standard context. If it fails, fallback to experimental.
- gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl');
-
- // If we don't have a GL context, give up now
- if (!gl) {
- alert('Unable to initialize WebGL. Your browser may not support it.');
- }
-
- return gl;
-}
-
-// The start function called in the browser
-function start() {
- var canvas = document.getElementById('glCanvas');
-
- // Initialize the GL context
- gl = initWebGL(canvas);
-
- // Only continue if WebGL is available and working
- if (!gl) {
- return;
- }
-
-
- // Set the render resolution
- gl.viewport(0, 0, canvas.width, canvas.height);
- // Set clear color to black, fully opaque
- gl.clearColor(0.0, 0.0, 0.0, 1.0);
- // Enable depth testing
- gl.enable(gl.DEPTH_TEST);
- // Near things obscure far things
- gl.depthFunc(gl.LEQUAL);
- // Clear the color as well as the depth buffer.
- gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
-}
\ No newline at end of file
diff --git a/playground/drawgl.html b/playground/drawgl.html
index a8f3f70..c503999 100644
--- a/playground/drawgl.html
+++ b/playground/drawgl.html
@@ -10,7 +10,7 @@
-
+
-
+