From 689721d75b3f89a343a7450854a205058dd53c0b Mon Sep 17 00:00:00 2001 From: Miguel Astor Date: Wed, 8 Jan 2014 15:29:54 -0430 Subject: [PATCH] Fixed some problems receiving the image from NxtCAM. --- src/ve/ucv/ciens/ccg/nxtar/NxtARCore.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/ve/ucv/ciens/ccg/nxtar/NxtARCore.java b/src/ve/ucv/ciens/ccg/nxtar/NxtARCore.java index 8af31ea..533bfa6 100644 --- a/src/ve/ucv/ciens/ccg/nxtar/NxtARCore.java +++ b/src/ve/ucv/ciens/ccg/nxtar/NxtARCore.java @@ -107,6 +107,8 @@ public class NxtARCore implements ApplicationListener, NetworkConnectionListener @Override public void render(){ + Pixmap image; + Pixmap temp; byte[] frame; Size dimensions; @@ -118,7 +120,10 @@ public class NxtARCore implements ApplicationListener, NetworkConnectionListener texture.dispose(); dimensions = frameMonitor.getFrameDimensions(); - texture = new Texture(new Pixmap(frame, 0, dimensions.getWidth() * dimensions.getHeight())); + temp = new Pixmap(frame, 0, dimensions.getWidth() * dimensions.getHeight()); + image = new Pixmap(1024, 512, temp.getFormat()); + image.drawPixmap(temp, 0, 0); + texture = new Texture(image); texture.setFilter(TextureFilter.Linear, TextureFilter.Linear); TextureRegion region = new TextureRegion(texture, 0, 0, dimensions.getWidth(), dimensions.getHeight()); @@ -132,6 +137,10 @@ public class NxtARCore implements ApplicationListener, NetworkConnectionListener batch.begin();{ sprite.draw(batch); }batch.end(); + + texture.dispose(); + temp.dispose(); + image.dispose(); } }