干精灵(2D)运动与OpenGL ES 2.0的Andr​​oid上 [英] Jerky sprite (2d) movement with OpenGL ES 2.0 on Android

查看:763
本文介绍了干精灵(2D)运动与OpenGL ES 2.0的Andr​​oid上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

2,编辑的logcat中添加的屏幕截图。如果我减少精灵的数量为1,我仍然得到这个间歇性的停止/开始 - 所以我不认为这是我的code,与1雪碧我的帧速率徘徊在85-90帧。我猜这是在手机上的东西,也有很多事情通过logcat中被记录,所以我承担大量的在后台运行的东西。有什么办法给我的应用某种优先于其他服务的,而它的运行?

Edit 2. Added screenshot of logcat. If I reduce the number of sprites to 1, I still get this intermittent 'stop/starting' - so I don't think it's my code, as with 1 sprite my frame rate hovers around 85-90 fps. I'm guessing it's something on the phone, there are lots of things being logged by logcat so I'm assuming lots of things running in the background. Is there any way to give me app some kind of priority over other services while it's running?

编辑1.请参阅编辑细节会在问题结束

我创建了一个精灵测试中,我使aprox的290精灵。

I've created a sprite test in which I render aprox 290 sprites.

1精灵每秒帧数约为80和288它仍然是在30,问题是,精灵停止,现在开始每然后,它不是帧速率明显,所以没有任何人有想法是什么可能会导致此? (只是要清楚它没有放慢脚步,而是一段时间的平稳运动,那么一切形式的停止一秒钟的一小部分,然后又回到了平滑)。

The frames per second with 1 sprites was around 80 and with 288 it is still at about 30, the problem is that the sprites stop and start every now and then, it's not the frame rate obviously, so does anyone have idea what may be causing this? (Just to be clear it's not slow down, but rather, smooth movement for a while, then everything kind of stops for a fraction of a second, then it's back to smooth).

这也恰好与屏幕上的一个精灵 - 但只是断断续续地和每5秒左右 - 越精灵添加,更碰巧的是,但帧速率永远不会跌破30 fps的,(我的理解应该要平稳运动OK),所以我只是想了解,这可能是什么。

This also happens with one sprite on the screen - but only intermittently and every 5 seconds or so - the more sprites I add, the more it happens, but the frame rate is never dropping below 30 fps, (which I understand should be OK for smooth movement), so I'm just trying to understand what this could be.

我的精灵创建了一个自定义类的,但只有3中创建(背景,即在屏幕上移动一个精灵(这样我就可以测量平整度)实际的对象,然后288精灵(这实际上是同一个对象重新使用),其在6批呈现

My sprites are created out of a custom class, but there are only 3 actual objects created (the background, a sprite that moves across the screen (so I can gauge smoothness) and then 288 sprites (which are actually the same object re-used) which are rendered in batches of 6.

感谢您的帮助。

硬件是一个三星Galaxy王牌手机。

The hardware is a Samsung Galaxy Ace phone.

修改确定,所以我按配料常规改变,现在我使每次通话24精灵(14来电= 336 +四边形移动精灵+背景= 338四边形)和我得到约47 FPS ,所以我在想什么可以从GC或帧率下降太远导致这种干运动?

Edit OK, so I altered by batching routine and now I'm rendering 24 sprites per call (14 calls = 336 quads + moving sprite + background = 338 quads) and am getting around 47 FPS, so I'm left wondering what could cause this 'jerky' movement apart from the GC or the frame-rate dropping too far?

推荐答案

听起来像垃圾回收器运行。为了验证这一点,只要看看...... logcat中做生涩时刻关联到标签dalvikvm线路,并与领导GC _?

Sounds like the garbage collector running. To verify this, just look at logcat... do the jerky moments correlate to lines tagged "dalvikvm" and lead with "GC_"?

这篇关于干精灵(2D)运动与OpenGL ES 2.0的Andr​​oid上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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