1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
8 initializeWebGL = function(canvas
) {
10 // Try to grab the standard context.
11 gl_context
= canvas
.getContext("webgl") ||
12 canvas
.getContext("experimental-webgl");
13 // If we don't have a GL context, give up now
15 alert("Unable to initialize WebGL. Your browser may not support it.");
19 startWebGLContext = function() {
20 var canvas
= document
.getElementById("glcanvas");
21 // Initialize the GL context.
22 initializeWebGL(canvas
);
24 // Only continue if WebGL is available and working.
26 gl_context
.clearColor(0.0, 0.0, 0.0, 1.0);
27 gl_context
.enable(gl_context
.DEPTH_TEST
);
28 gl_context
.depthFunc(gl_context
.LEQUAL
);
29 gl_context
.clearDepth(1);
30 gl_context
.clear(gl_context
.COLOR_BUFFER_BIT
|
31 gl_context
.DEPTH_BUFFER_BIT
);