use*_*195 13 opengl-es framebuffer ios opengl-es-2.0
我们试图弄清楚为什么我们在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
Run Code Online (Sandbox Code Playgroud)
...... ......
// 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];
Run Code Online (Sandbox Code Playgroud)
我们实际上并没有使用深度或模板缓冲区.
当我们将纹理渲染为切片时会发生这种情况,并且每次加载新切片时都会发生这种情况.它指向我们的glDrawArrays命令.
关于我们如何摆脱这种警告的任何建议?
如果它有帮助,这就是我们设置图层的方式:
eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:NO], kEAGLDrawablePropertyRetainedBacking,
kEAGLColorFormatRGB565, kEAGLDrawablePropertyColorFormat,
nil];
Run Code Online (Sandbox Code Playgroud)
小智 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];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2332 次 |
| 最近记录: |