private void processDepth() {
    NUI_IMAGE_FRAME imageFrame = new NUI_IMAGE_FRAME();
    checkRC(device.NuiImageStreamGetNextFrame(depthStream, new DWORD(0), imageFrame));

    BOOLByReference isNearMode = new BOOLByReference();
    INuiFrameTexture.ByReference newTexture = new INuiFrameTexture.ByReference();

    checkRC(
        device.NuiImageFrameGetDepthImagePixelFrameTexture(
            depthStream, imageFrame, isNearMode, newTexture));

    INuiFrameTexture frameTexture = newTexture.getTexture();

    NUI_LOCKED_RECT lockedRect = new NUI_LOCKED_RECT();
    checkRC(frameTexture.LockRect(new UINT(0), lockedRect, null, new DWORD(0)));

    if (lockedRect.Pitch == 0) throw new RuntimeException("Kinect didn't give us data");

    byte[] bytes = lockedRect.getBytes();
    checkRC(frameTexture.UnlockRect(0));

    checkRC(
        interactionStream.ProcessDepth(
            new UINT(bytes.length), bytes, imageFrame.liTimeStamp.getValue()));

    frameTexture.Release();
    checkRC(device.NuiImageStreamReleaseFrame(depthStream, imageFrame));
  }
  @Override
  public ByteBuffer getVisualData() {
    Kernel32.INSTANCE.WaitForSingleObject(nextColorImageFrame, Kernel32.INFINITE);
    NUI_IMAGE_FRAME imageFrame = new NUI_IMAGE_FRAME();
    checkRC(device.NuiImageStreamGetNextFrame(colorStream, new DWORD(0), imageFrame));
    NUI_LOCKED_RECT lockedRect = new NUI_LOCKED_RECT();
    checkRC(imageFrame.pFrameTexture.LockRect(new UINT(0), lockedRect, null, new DWORD(0)));

    if (lockedRect.Pitch == 0) throw new RuntimeException("Kinect didn't give us data");

    ByteBuffer buf = ByteBuffer.wrap(lockedRect.getBytes());
    checkRC(imageFrame.pFrameTexture.UnlockRect(0));

    // Release the frame
    checkRC(device.NuiImageStreamReleaseFrame(colorStream, imageFrame));

    return buf;
  }