Read Pixels (screenshot) is flipped in iOS devices


#1

Hi There, I’ve noticed that in iOS the Kudan AR works just fine. But when I try to run the read pixels to take a screen shot the background texture is flipped. It happens only for iOS devices and only when I try to a screenshot. Infact the 3D model on the AR marker seems fine and upright. So just the texture backgroundrenderer is flipped not the model. THIS DOESN’T HAPPEN IF I’M NOT DOING A SCREENSHOT. Why is this happening? How can we resolve this?

byte[] TakeScreenShot(Enums.ImageType imageType,int resWidth, int resHeight, int scale){
    int resWidthN = resWidth * scale;
    int resHeightN = resHeight * scale;
    RenderTexture rt = new RenderTexture(resWidthN, resHeightN, 24);
    myCamera.targetTexture = rt;
    TextureFormat tFormat;
    tFormat = TextureFormat.RGB24;
    Texture2D screenShot = new Texture2D(resWidthN, resHeightN, tFormat, false);
    myCamera.Render();
    RenderTexture.active = rt;
    screenShot.ReadPixels(new Rect(0, 0, resWidthN, resHeightN), 0, 0);
    myCamera.targetTexture = null;
    RenderTexture.active = null;
    switch (imageType)
    {
        case Enums.ImageType.JPG:
            return screenShot.EncodeToJPG();
        case Enums.ImageType.PNG:
            return screenShot.EncodeToPNG();
        default:
            return null;
    }
}