فهرست منبع

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;
+	
+}