glFlush()vs [[self openGLContext] flushBuffer] vs glFinish vs glSwapAPPLE vs aglSwapBuffers [英] glFlush() vs [[self openGLContext] flushBuffer] vs glFinish vs glSwapAPPLE vs aglSwapBuffers

查看:102
本文介绍了glFlush()vs [[self openGLContext] flushBuffer] vs glFinish vs glSwapAPPLE vs aglSwapBuffers的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用NSOpenGLView时,有几种类似的OpenGL操作:

There are several similar OpenGL operations when working with an NSOpenGLView:

  • glFlush()
  • [[self openGLContext] flushBuffer]
  • glFinish()
  • glSwapAPPLE
  • aglSwapBuffers
  • glFlush()
  • [[self openGLContext] flushBuffer]
  • glFinish()
  • glSwapAPPLE
  • aglSwapBuffers

何时应使用其中的每一个?

When should each of these be used?

在示例应用程序中,Apple使用glFlush(),然后使用[[self openGLContext] flushBuffer].他们为什么同时使用这两种方式?

In a sample application, Apple uses glFlush(), followed by [[self openGLContext] flushBuffer]. Why do they use both of these?

如果我使用双缓冲可可NSOpenGLView,什么是正确的方法?

What would be the right approach, if I am using a double-buffered Cocoa NSOpenGLView?

推荐答案

您是否看过

Have you looked at this? It explains when to use glFlush() and glFinish(). Both are OpenGL functions that control execution and synchronizing of commands. Generally you would want to use these functions when doing multi-threaded rendering otherwise there shouldn't be any need.

glSwapAPPLE()和aglSwapBuffers()是Apple提供的扩展程序,用于在屏幕上显示后台缓冲区的内容(在Windows上是wglSwapBuffers()).您应该使用其中一个,但不能同时使用,因为它们确实在做同样的事情.我会坚持使用AGL方法,因为它类似于WGL,EGL等.

glSwapAPPLE() and aglSwapBuffers() are extensions provided by Apple to display the contents of the backbuffer to screen (on Windows it's wglSwapBuffers()). You should use either one but not both as they really do the same thing. I would stick to the AGL method as it's analogous to WGL, EGL, etc..

[[self openGLContext] flushBuffer]可能是glFlush()的目标C包装器.我无法想象它还有其他作用.

[[self openGLContext] flushBuffer] is probably an objective C wrapper to glFlush() from the looks of it. I can't imagine it doing anything else.

这篇关于glFlush()vs [[self openGLContext] flushBuffer] vs glFinish vs glSwapAPPLE vs aglSwapBuffers的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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