在OpenGL ES的自定义视图过渡 [英] Custom view transition in OpenGL ES

查看:140
本文介绍了在OpenGL ES的自定义视图过渡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个自定义过渡,以作为默认的过渡替代你会到这里来,例如:

I'm trying to create a custom transition, to serve as a replacement for a default transition you would get here, for example:

[self.navigationController pushViewController:someController animated:YES];

我有prepared执行映射到一个平面上一些静态的纹理效果一个基于OpenGL的视图(假设它是在核心动画的翻页效果复印件)。我不知道该怎么做的是:

I have prepared an OpenGL-based view that performs an effect on some static texture mapped to a plane (let's say it's a copy of the flip effect in Core Animation). What I don't know how to do is:


  • 抓取当前视图内容,使纹理出来的(我记得看到,不只是一个功能,但无法找到它)

  • 怎么做对当前屏幕外,并且将取代当前视图中的视图相同

  • 有没有一些API,我可以钩,以便使我的过渡类原生越好(使之成为一种核心动画效果)?

任何想法或链接大大AP preciated!

Any thoughts or links are greatly appreciated!

更新

杰弗里福布斯的回答的伟大工程作为解决捕获视图的内容。

Jeffrey Forbes's answer works great as a solution to capture the content of a view.

我还没有想出却又是如何捕捉我要过渡到视图,直到过渡完成它应该是不可见的内容。

What I haven't figured out yet is how to capture the content of the view I want to transition to, which should be invisible until the transition is done.

此外,该方法应该我使用present OpenGL的看法?
出于演示的目的,我用pushViewController。这影响了导航栏,虽然,这其实我想去一个项目回来,动画,请在此VID的解释是:

Also, which method should I use to present the OpenGL view? For demonstration purposes I used pushViewController. That affects the navbar, though, which I actually want to go one item back, with animation, check this vid for explanation:

http://vimeo.com/4649397

另一种选择是去与presentViewController,但显示全屏。
你想也许创建另一个窗口(或查看?)可能是有用的?

Another option would be to go with presentViewController, but that shows fullscreen. Do you think maybe creating another window (or view?) could be useful?

推荐答案

虽然我不能完全回答没有做我自己的一些调查研究你的问题,我可以帮了一下:

While I cannot completely answer your question without doing some more research of my own, I can help a bit:

- 为了得到一个UINavigationController的视图,你需要采取截图。要做到这一点最简单的方法是通过抓住它变成一个UIImage:

-In order to get the view of a UINavigationController, you need to take a screenshot. The easiest way to do this is by grabbing it into a UIImage:

UIGraphicsBeginImageContext(self.view.frame.size);
[[self.view layer] renderInContext:UIGraphicsGetCurrentContext()];
UIImage* test = UIGraphicsGetImageFromCurrentImageContext();
UIImageView* view = [[UIImageView alloc] initWithImage:test];
UIGraphicsEndImageContext();

我不知道你是否能呈现GLContext(在手机上不熟悉)到一个CGImage,但我会做这样的事情(并从初始化一个UIImage)。我想prerender你正在尝试做的,它一巴掌将使用中所提供的动画东西,一个的UIImageView动画的每一帧。也就是说,如果你的动画是很简单的。否则,它可能会回落到编写自己的动画功能: - /

I am not sure if you can render a GLContext (not familiar on the phone) into a CGImage, but I would do something like that (and init a UIImage from that). I would prerender every frame of the animation you are trying to do and slap it into an UIImageView using the animation stuff provided within. That is, if your animation is simple enough. Otherwise, it might come down to writing your own animation function :-/

这篇关于在OpenGL ES的自定义视图过渡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆