作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
使用 NSOpenGLView 时有几个类似的 OpenGL 操作:
glFlush()
[[self openGLContext]flushBuffer]
glFinish()
什么时候应该使用这些?
在示例应用程序中,Apple 使用 glFlush()
,后跟 [[self openGLContext]lushBuffer]
。为什么他们同时使用这两个?
如果我使用双缓冲 Cocoa NSOpenGLView,正确的方法是什么?
最佳答案
小心! [[self openGLContext]lushBuffer]
不仅仅是 gFlush()
的 Objective-C 包装器。仅当您在像素格式中设置双缓冲区时,此函数(Apple Documentation 中的 - (void)flushBuffer
)才有效
NSOpenGLPixelFormatAttribute attributes [] =
{
NSOpenGLPFADoubleBuffer,
// other presets like
// NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core,
// NSOpenGLPFADepthSize, 32,
0
};
NSOpenGLPixelFormat *pixelFormat = [[NSOpenGLPixelFormat alloc]
initWithAttributes:attributes];
否则你必须使用glFlush();
我花了很长时间才看到 NSOpenGLContext Class Reference 中的基本行。
关于cocoa - glFlush() vs [[self openGLContext]lushBuffer] vs glFinish vs glSwapAPPLE vs aglSwapBuffers,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7027346/
使用 NSOpenGLView 时有几个类似的 OpenGL 操作: glFlush() [[self openGLContext]flushBuffer] glFinish() glSwapAPPL
我是一名优秀的程序员,十分优秀!