English 中文(简体)
统一国际电算区和开放式电算中心
原标题:Combining UIView animation blocks and OpenGL ES rendering

I am developing an iP* game and I make use of both UIKit and OpenGL ES 2.0. The UIKit elements are rendered over the OpenGL view and occupy a significant (arbitrary) amount of screen space. I must admit that Apple has done an excellent work and the frame rate of the game is always 60 FPS.

In order to come to this conclusion I made many tests regarding the performance:

  1. I added lots of static (not moving) UIViews over the OpenGL view -- OK!
  2. I animated using custom code the same UIViews (modified the center property in the drawFrame method of my game) -- OK!.
  3. I added many OpenGL ES elements under the UIViews -- OK!
  4. I added many moving OpenGL ES elements under the UIViews -- OK!

因此,我现在要利用核心评价框架,以便总结国际调查的要素。 我是用的。

[UIView animateWithDuration:delay:options:animations:completion:]

in in perform(I Target 4 or newer)。

现在的问题是,基准率是weird行为: 有时,我有60个缩略语many 许多。 IDKit敏化元素(对我来说,30个元素是OK),而其他一些时候,即使有“single im UIKit元素,但我无法用仪器衡量它! 让我进一步解释: 当我开放仪器并监测核心估计和(或)开放式GL驱动力时,我总是有60个。 But 很明显,情况并非如此,我可以亲眼看到开放式的GL调子,其速度要慢于相应的“IDKit”调子。 如果我从这个观点中删除“科索沃信托公司”要素,该基准率就会恢复正常。 我所描述的类似情况发生在任何开放的利比里亚人经济游戏中,当时用户在玩游戏时改变该装置的数量。 当显示目前数额的透明观点开始消失时,直到完全放弃框架比率急剧下降,但在文书中(我已做过这一检验),它被困在60英尺上!

因此,总而言之:有时,我有60个直径,没有 up子和 down子,有时还有60个直径,没有 up子。

Do you have any solution to this? All tests were performed on an iPad 2 and iPhone 3GS with iOS 5.1

最佳回答

我设法解决了这一问题,现在我可以在我的开放式GL游戏中把“IDView团”/基于核心的估算结合起来,而不会出现任何业绩下降。

解决办法非常简单:

  1. For each UIView that you want in your OpenGL app, keep its bounds, center and transform properties in your OpenGL screen coordinate system (e.g. create the following properties: GLBounds, GLCenter, GLTranform) and update them accordingly whenever you change one of the corresponding UIView properties.
  2. When you start the game, load the UIViews but set them to hidden. So, UIKit does not draw on top of the OpenGL view (this way the frame drop issue is completely elliminated).Instead draw the UIViews yourself using the GL* properties you created in step 1, and using the corresponding textures (the images/colors you used for every UIView).
  3. Animate the hidden UIViews properties (bounds, center and transform) using block/core animation depending on the animation you want to achieve (which in turn updates your GL* properties) and in your OpenGL draw method use the GL* properties to draw the UIViews! To get the actual values for bounds, center and transform when a UIView is animating (and update the GL* properties) use its presentationLayer property.

最好

问题回答

暂无回答




相关问题
images sliding continuously with <table> and jQuery

I m trying to write a little test page that circulates images through a window (see image). I have colored boxes inside a table (gray border), with each box being a element. <table id="boxes" ...

WPF 3d rotation animations

I have a few 3d rectangles on my screen that I want to pivot around the Y axis. I want to press down with the mouse, and rotate the 3d object to a max rotation, but when the user moves their mouse, ...

Disable Windows 7 touch animation in WPF

In Windows 7 when you touch the screen there is a short animation that occurs at the touch point. In my WPF app I want to display my own touch points, without showing the one supplied by Windows. ...

jQuery block moving

I wanna move a div block to the top, so I coded like this: CSS part: .movingPart{ margin-top:80px; } jQuery part: $(document).ready(function() { $( #btn ).click(function() { $( .movingPart )....

Direct 2D gnuplot PNG animation?

Can anyone please confirm that yes/no Gnuplot 4.5 (on CVS) can output 2D animated PNG files? I have numerous datasets but one line that I d like to show iteratively in 3 different places in my graph. ...

Visual State Manager VS Animations in WPF

There is a lot of talk about the simplicity of Visual States and the transitions between them in WPF/Silverlight. I have the need to generate animations dynamically at runtime, to animate the ...

Create a ImageIcon that is the mirror of another one

I ll like to know if there is a way to create a ImageIcon that is the mirror of another ImageIcon. Searching on Google, I found how to do it by using many AWT libraries. Is there a way to do it with ...

how to drag in the animation in iphone application?

Iphone application is using the static co-ordinates to reach at some points in the application,which is based on the button event. But what i want is when i drag the item than it should reach at some ...

热门标签