开发者

Converting an OpenGL transformation matrix to work on a CATransformLayer

I've been using an Augmented Reality SDK from String for a project. Basically this SDK passes back a bunch of markers for images that it recognises, and an associated OpenGL matrix transform that outlines where the marker image is located in 3D space within the iPhone's camera view. What I'm trying to do is to map a CATransformLayer against the scene so that it appears properly oriented on the marker 开发者_StackOverflow中文版image and play back a video in it's place. I thought that I could do this using an AVPlayerLayer sitting inside a CATransformLayer that has the matrix transform (converted to a CATransform3D) applied to it.

Best I can tell, this doesn't work particularly well — I can't seem to get a logical mapping between the original OpenGL matrix and the matrix behind the CATransform3D.

You can see that it's pretty messed up doing a direct conversion between the marker transform and a CATransform3D object (the blue bit is my layer):

Converting an OpenGL transformation matrix to work on a CATransformLayer

I assumed that they were the same (I've been told a few times that they're identical due to CALayer GL backing). Is this true? Am I missing something?

I can drop back to rendering my video as a texture into the scene, but it'd be great to keep things high level if possible — any ideas/comments/thoughts?


Try looking at this answer. It should do what you need.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜