Fixed some problems receiving the image from NxtCAM.
This commit is contained in:
@@ -107,6 +107,8 @@ public class NxtARCore implements ApplicationListener, NetworkConnectionListener
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(){
|
public void render(){
|
||||||
|
Pixmap image;
|
||||||
|
Pixmap temp;
|
||||||
byte[] frame;
|
byte[] frame;
|
||||||
Size dimensions;
|
Size dimensions;
|
||||||
|
|
||||||
@@ -118,7 +120,10 @@ public class NxtARCore implements ApplicationListener, NetworkConnectionListener
|
|||||||
texture.dispose();
|
texture.dispose();
|
||||||
|
|
||||||
dimensions = frameMonitor.getFrameDimensions();
|
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);
|
texture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
|
||||||
|
|
||||||
TextureRegion region = new TextureRegion(texture, 0, 0, dimensions.getWidth(), dimensions.getHeight());
|
TextureRegion region = new TextureRegion(texture, 0, 0, dimensions.getWidth(), dimensions.getHeight());
|
||||||
@@ -132,6 +137,10 @@ public class NxtARCore implements ApplicationListener, NetworkConnectionListener
|
|||||||
batch.begin();{
|
batch.begin();{
|
||||||
sprite.draw(batch);
|
sprite.draw(batch);
|
||||||
}batch.end();
|
}batch.end();
|
||||||
|
|
||||||
|
texture.dispose();
|
||||||
|
temp.dispose();
|
||||||
|
image.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user