我目前正在使用WebCamTexture类显示实时摄像机供稿,直到用户拍摄快照为止,然后在我的应用程序中将所述快照用作纹理。

这是我目前正在使用的代码:

private WebCamTexture cameraTexture;
private Texture2D snapshot;
public UITexture webCamTexture;

snapshot = new Texture2D(cameraTexture.width, cameraTexture.height);
snapshot.SetPixels(m_CameraTexture.GetPixels());
snapshot.Apply();
webCamTexture.mainTexture = snapshot;

注意:UITexture类来自NGUI,仅用于在场景上显示纹理。

在Android设备上,似乎没有问题。但是,当我在iOS设备上使用此功能(在iPad2和iPad3上测试)时,纹理立即变为
设置时模糊。这是焦点问题吗?

我尝试了几件事,主要是在拍摄之前等待帧结束,并在获取像素之前调用cameraTexture.Pause(),
无济于事。

为什么iOS纹理变得模糊?

最佳答案

我有同样的问题,但是在Texture2D构造函数中将mipmaps设置为false似乎可以解决此问题

即:

snapshot = new Texture2D(webcamTexture.width, webcamTexture.height, TextureFormat.ARGB32, false);

关于它为什么不幸的工作,我没有任何解释。

关于ios - WebCamTexture iOS模糊快照,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/24129205/

10-14 21:43