问题描述
此问题与有关
我有一个简单的2D游戏(有几个精灵)。 glFlush()执行时间从1ms到30ms不等,帧内容相同。你知道为什么吗?我确信当我计算它时,我没有将帧内容从一帧更改为另一帧,它是一个具有大约30个精灵的静态场景。我使用~5MB纹理内存,额外的4MB分配用于纹理加载。我在一个线程上使用opengles 1.1。我有其他的步骤,但他们没有使用opengl。此行为是在iPhone 3G上使用iOS 4.2
我在我的iPad(第3代)上尝试了这个,当你编译为iPad glFlush()对于少量几何(2个三角形)需要0.5ms,对于更多几何(2 tris + 100点)需要15ms。大部分时间都在等待displaylink回调。但是当您编译 iPhone 时,glFlush()至少花费15毫秒,这就是花费大部分游戏时间的地方(如果你有一个相对空的帧!)。如果你进入2x模式(app在iPhone模式下运行,在iPad上运行),glFlush在每一帧上完成交替所需的时间:15ms,30ms,15ms,30ms。我猜iPhone的架构与iPad的架构不同,iPhone上的glFlush()命令中有一些帧限制器(请记住,我只在我的iPad上尝试了iPHone模式)。 p> this question is related to presentRenderbuffer : GL_RENDERBUFFER_OES takes long time I have a simple 2D game(with several sprites). glFlush() execution time varies from 1ms to 30ms with same frame content. Do you know why? I am sure that I don't have frame content changed from one frame to another when I compute this, it's a static scene with about 30 sprites. I use ~5MB texture memory with additional 4MB allocated for texture loading. I use opengles 1.1 on a single thread. I have other treads, but they are not using opengl. This behavior is on iPhone 3G with iOS 4.2 I tried this on my iPad (3rd gen), and when you compile for iPad glFlush() takes something like 0.5ms for small amounts of geometry (2 triangles), and 15ms for more geometry (2 tris+100 points). The majority of the time is waiting for the displaylink to callback. But when you compile for iPhone, glFlush() takes a minimum of 15ms, and that's where the majority of the game time is spent (if you have a relatively empty frame!). And if you go into 2x mode (app running in iPhone mode, on an iPad), the time it takes for glFlush to complete alternates on every frame: 15ms,30ms,15ms,30ms. I guess iPhone is architected differently from iPad, and there is some kind of frame limiter inside the glFlush() command on the iPhone, (remember, I only tried iPHone mode on my iPad)!. 这篇关于glFlush()时间因帧而异,在iPhone上具有相同的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!