13

我们试图弄清楚为什么我们在 iphone 4 和 ipad 1 上的 FPS 相对较慢。我们在我们的开放式 GL 分析:逻辑缓冲区负载中看到了这种警告类别。摘要是“缓慢的帧缓冲区加载”。建议说帧缓冲区必须在渲染之前由 GPU 加载。它建议我们在每一帧的开头都没有执行全屏清除操作。但是,我们使用 glClear 来执行此操作。

[EAGLContext setCurrentContext:_context];

glBindFramebuffer(GL_FRAMEBUFFER, _defaultFramebuffer);
glClear(GL_COLOR_BUFFER_BIT);

// Our OpenGL Drawing Occurs here

…………

// hint to opengl to not bother with this buffer
const GLenum discards[]  = {GL_DEPTH_ATTACHMENT};
glBindFramebuffer(GL_FRAMEBUFFER, _defaultFramebuffer);
glDiscardFramebufferEXT(GL_FRAMEBUFFER, 1, discards);

// present render
[_context presentRenderbuffer:GL_RENDERBUFFER];

我们实际上并没有使用深度或模板缓冲区。

当我们将纹理渲染为瓦片时会发生这种情况,并且每次加载新瓦片时都会发生这种情况。它指向我们的 glDrawArrays 命令。

关于我们如何摆脱这个警告的任何建议?

如果它有帮助,这就是我们设置图层的方式:

eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys:
                                [NSNumber numberWithBool:NO], kEAGLDrawablePropertyRetainedBacking,
                                kEAGLColorFormatRGB565, kEAGLDrawablePropertyColorFormat,
                                nil];
4

1 回答 1

0

经过大量的工作和深思熟虑,我最终设法弄清楚了这一点。

好的,我正在使用一个名为 GLESuperman 的开源库。它是一个很棒的库,可以帮助调试这些问题,并且可以用于绘制图形 - 它非常快。是的,我不知道它为什么这么叫......但它是免费的,而且它有效。只需在 Github 上搜索即可。它会经常更新并支持 iOS 7 及更高版本。

好的,要实现它,请执行以下操作:

// Import the framework into your Xcode project.
#import <GLESuperman/GLESuperman.h>

// Also you will need to import Core Graphics.
#import <CoreGraphics/CoreGraphics.h>

// In order to run it in debug mode and get 
// a live detailed report about things like FPS, do the following.
GLESuperman *debugData = [[GLESuperman alloc] init];
[debugData runGraphicDebug withRepeat:YES inBackground:YES];

// In order to draw graphics, do the following.
GLESuperman *graphicView = [[GLESuperman alloc] init];
[graphicView drawView:CGRectMake(0, 0, 50, 50];

// You can do other things too like add images/etc..
// Just look at the library documentation, it has everything.

[graphicView setAlpha:1.0];
[graphicView showGraphic];
于 2015-03-12T10:00:09.447 回答