浏览代码

Make it possible to disable WebGl2 (#565)

close #562
Leo Bergman 6 年之前
父节点
当前提交
86d0b21290
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      h3d/impl/GlDriver.hx

+ 3 - 1
h3d/impl/GlDriver.hx

@@ -146,6 +146,7 @@ class GlDriver extends Driver {
 	var mrtExt : { function drawBuffersWEBGL( colors : Array<Int> ) : Void; };
 	static var UID = 0;
 	public var gl : GL2;
+	public static var ALLOW_WEBGL2 = true;
 	#end
 
 	#if (hlsdl||usegl)
@@ -192,7 +193,8 @@ class GlDriver extends Driver {
 		#if js
 		canvas = @:privateAccess hxd.Window.getInstance().canvas;
 		var options = {alpha:false,stencil:true,antialias:antiAlias>0};
-		gl = cast canvas.getContext("webgl2",options);
+		if(ALLOW_WEBGL2) 
+			gl = cast canvas.getContext("webgl2",options);
 		if( gl == null )
 			gl = cast canvas.getContextWebGL(options);
 		if( gl == null ) throw "Could not acquire GL context";