0

如何从 Projection 和 ModelView 矩阵中获取 CATransform3D

我以前浏览过这个问题,网址;但不是绝对准确;我想知道为什么不准确;</p>

我发现x-axis和y-axis的旋转是相反的(我不能发布图像);梯形(当旋转calayer时,它就像一个梯形)是相反的,dose calayer rotate不像opengl?但按z轴旋转时是正确的。

我想得到角度然后反向旋转两次;如何通过opengl矩阵得到角度?</p>

我想播放 QCAR 的电影;我可以得到opengl矩阵,我想用UIView来播放电影和其他(熟悉UIView),并使UIview像Texture。

4

1 回答 1

0

I just post a example on QCAR forum, you can check the detail here

The idea is simple.

1.I don't use avassetreader to read the video pixel, instead I use AVPlayer and AVPlayerLayer which can play remote video file.

2.I need to convert opengl modelview matrix to CATransform3D so the AVPlayerLayer will attach on the trackable image.Thanks for Hammer on stackoverflow, he shared an example about how to make this.

3.I tried to render camera background use opengl and AVPlayerLayer at same time, but the performace is not good enough, so I use another calayer to render the camera background. There is a bug in 1.5.8 when getting camera frame, thank for andersfrank the problem was solved here.

I put my code on pastebin:

http://pastebin.com/kmeVZ7jy

There are still some problem need to solve, but I think this is a right approach.

PS. For question 3 in my original post, you can fix it by set

        cameraLayer.contentsGravity = kCAGravityResizeAspectFill;

This will fix the problem that the aspect ratio of the camera image is different with the iphone screen's.

Update

All the problem are solved, please check my original post on vuforia and pastebin.

于 2012-07-09T05:06:18.453 回答