Browse Source

capturePixels on HL support

Nicolas Cannasse 9 years ago
parent
commit
b8b9ee0cb5
2 changed files with 2 additions and 4 deletions
  1. 1 1
      h3d/impl/GlDriver.hx
  2. 1 3
      samples/GraphicsDraw.hx

+ 1 - 1
h3d/impl/GlDriver.hx

@@ -723,7 +723,7 @@ class GlDriver extends Driver {
 	override function captureRenderBuffer( pixels : hxd.Pixels ) {
 		if( curTarget == null )
 			throw "Can't capture main render buffer in GL";
-		#if js
+		#if (js || hl)
 		gl.readPixels(0, 0, pixels.width, pixels.height, GL.RGBA, GL.UNSIGNED_BYTE, @:privateAccess pixels.bytes.b);
 		pixels.format = RGBA;
 		#end

+ 1 - 3
samples/GraphicsDraw.hx

@@ -68,9 +68,7 @@ class GraphicsDraw extends hxd.App {
 		// test capture bitmap
 
 		bclone = new h2d.Bitmap(h2d.Tile.fromTexture(new h3d.mat.Texture(256, 256)), s2d);
-		#if js
 		bclone.blendMode = None; // prevent residual alpha bugs
-		#end
 		bclone.y = 512;
 
 		// set up graphics instance for use in redraw()
@@ -90,7 +88,7 @@ class GraphicsDraw extends hxd.App {
 		}
 		pg.drawTo(t);
 
-		var pix = t.capturePixels();
+		var pix = t.capturePixels(true);
 		bclone.tile.getTexture().uploadPixels(pix);
 		pix.dispose();
 	}