I like a few others on here have wanted to play around with the raw image data.
following the instructions I believe the following should get both images when OnImageRead is assigned to the ImageReady callback:
Texture2D leftEye;
Texture2D rightEye;
public RenderTexture renTexL;
public RenderTexture renTexR;
byte[] bs_l;
byte[] bs_r;
void OnImageReady(object sender, Leap.ImageEventArgs args)
{
if(leftEye == null)
{
leftEye = new Texture2D(args.image.Width, args.image.Height, TextureFormat.R8, false);
}
if (rightEye == null)
{
rightEye = new Texture2D(args.image.Width, args.image.Height, TextureFormat.R8, false);
}
bs_l = args.image.Data(Leap.Image.CameraType.LEFT);
if (bs_l != null)
{
leftEye.LoadRawTextureData(bs_l);
leftEye.Apply();
Graphics.Blit(leftEye, renTexL);
}
bs_r = args.image.Data(Leap.Image.CameraType.RIGHT);
if (bs_r != null)
{
rightEye.LoadRawTextureData(bs_r);
rightEye.Apply();
Graphics.Blit(rightEye, renTexR);
}
if (bs_l == bs_r) Debug.Log("WHY!");
}
However on execution both byte[] are the same no errors are reported.
Can one of the devs explain what is happening and update the documentation to clarify this behaviour?
args.image.Data() requires a camera type a a parameter, why is this if it makes no difference?