Browse Source

fix for usegl (#305)

crautou 7 years ago
parent
commit
a7f6ee1925
2 changed files with 7 additions and 6 deletions
  1. 6 5
      h3d/impl/GlDriver.hx
  2. 1 1
      h3d/mat/Texture.hx

+ 6 - 5
h3d/impl/GlDriver.hx

@@ -150,7 +150,7 @@ class GlDriver extends Driver {
 		curAttribs = 0;
 		curMatBits = -1;
 		defStencil = new Stencil();
-		#if hlsdl
+		#if (hlsdl || usegl)
 		var v : String = gl.getParameter(GL.VERSION);
 		if( v.indexOf("ES") < 0 ){
 			commonVA = gl.createVertexArray();
@@ -250,10 +250,11 @@ class GlDriver extends Driver {
 				glout.version = shaderVersion;
 			else
 				glout.glES = true;
+
 			p.vertex = compileShader(glout,shader.vertex);
 			p.fragment = compileShader(glout,shader.fragment);
 			p.p = gl.createProgram();
-			#if hlsdl
+			#if (hlsdl || usegl)
 			if( !glout.glES ) {
 				var outCount = 0;
 				for( v in shader.fragment.data.vars )
@@ -1014,7 +1015,7 @@ class GlDriver extends Driver {
 			#if js
 			if( mrtExt != null )
 				mrtExt.drawBuffersWEBGL([GL.COLOR_ATTACHMENT0]);
-			#elseif hlsdl
+			#elseif (hlsdl || usegl)
 			gl.drawBuffers(1, CBUFFERS);
 			#end
 		}
@@ -1071,7 +1072,7 @@ class GlDriver extends Driver {
 		#if js
 		if( mrtExt != null )
 			mrtExt.drawBuffersWEBGL([for( i in 0...textures.length ) GL.COLOR_ATTACHMENT0 + i]);
-		#elseif hlsdl
+		#elseif (hlsdl || usegl)
 			gl.drawBuffers(textures.length, CBUFFERS);
 		#end
 	}
@@ -1242,7 +1243,7 @@ class GlDriver extends Driver {
 		GL.TEXTURE_CUBE_MAP_NEGATIVE_Z,
 	];
 
-	#if hlsdl
+	#if (hlsdl || usegl)
 	static var CBUFFERS = hl.Bytes.getArray([for( i in 0...32 ) GL.COLOR_ATTACHMENT0 + i]);
 	#end
 

+ 1 - 1
h3d/mat/Texture.hx

@@ -19,7 +19,7 @@ class Texture {
 	/**
 		Tells if the Driver requires y-flipping the texture pixels before uploading.
 	**/
-	public static inline var nativeFlip = 	#if (hlsdl) true
+	public static inline var nativeFlip = 	#if (hlsdl||usegl) true
 											#elseif (openfl) false
 											#elseif (lime && (cpp || neko || nodejs)) true
 											#else false #end;