Преглед на файлове

Quick fix for Detector that got broken with latest Chrome canary.

For some reason Chrome canary 12.0.713.0 doesn't have "window.WebGLRenderingContext".
alteredq преди 14 години
родител
ревизия
633276ddd8
променени са 1 файла, в които са добавени 11 реда и са изтрити 1 реда
  1. 11 1
      examples/js/Detector.js

+ 11 - 1
examples/js/Detector.js

@@ -7,7 +7,7 @@ Detector = {
 	// supported features
 
 	canvas	: !!window.CanvasRenderingContext2D,
-	webgl	: !!window.WebGLRenderingContext,
+	webgl	: detectWebGL(),
 	workers : !!window.Worker,
 	fileapi : window.File && window.FileReader && window.FileList && window.Blob,
 	
@@ -59,5 +59,15 @@ Detector = {
 		return message;
 
 	}
+	
 
 };
+
+function detectWebGL() {
+	
+	var c = document.createElement( "canvas" ),
+	webGLContext = c.getContext("experimental-webgl");
+	
+	return window.WebGLRenderingContext || webGLContext;
+	
+}