medea/medea.context.js
// first initialization phase -- create webgl canvas and prepare environment
first initialization phase -- create webgl canvas and prepare environment
first initialization phase -- create webgl canvas and prepare environment
function _init_level_0() {
		medeactx.canvas  = document.getElementById(where);
		var candidates = ["webgl", "experimental-webgl", "webkit-3d", "moz-webgl"]
		,	i
		,	context = null
		;
		for (i = 0; i < candidates.length; ++i) {
			try {
				context = medeactx.canvas.getContext(candidates[i], {
					stencil : true
				});
			} catch(ex) {
			}
			if (context) {
				break;
			}
		}
		if(!context) {
			medealib.Log('webgl initialization failed','error');
			if(user_on_failure) {
				user_on_failure();
			}
			return false;
		}
		if (window.WebGLDebugUtils !== undefined) {
			context = WebGLDebugUtils.makeDebugContext(context);
		}
		medealib.LogDebug('webgl context successfully created');
		medeactx.gl = context;
		return true;
	}
function _init_level_0 ( ) { medeactx . canvas = document . getElementById ( where ) ; var candidates = [ "webgl" , "experimental-webgl" , "webkit-3d" , "moz-webgl" ] , i , context = null ; for ( i = 0 ; i < candidates . length ; ++ i ) { try { context = medeactx . canvas . getContext ( candidates [ i ] , { stencil : true } ) ; } catch ( ex ) { } if ( context ) { break ; } } if ( ! context ) { medealib . Log ( 'webgl initialization failed' , 'error' ) ; if ( user_on_failure ) { user_on_failure ( ) ; } return false ; } if ( window . WebGLDebugUtils !== undefined ) { context = WebGLDebugUtils . makeDebugContext ( context ) ; } medealib . LogDebug ( 'webgl context successfully created' ) ; medeactx . gl = context ; return true ; }
first initialization phase -- create webgl canvas and prepare environment
first initialization phase -- create webgl canvas and prepare environment
// #if DEBUG //medeactx.Assert(medeactx.canvas != null, "element with #id \"" + where + "\" not found"); // #endif // create a webgl context // try out all the names under which webgl might be available // Request a stencil buffer by default (D24S8 should be // universally available, if not this needs to be revised) // no matter what happens, we take the first non-null context we get // #if LOG // #endif // automatically create debug context if webgl-debug.js is present // #ifdef LOG // #endif