首页 > 其他 > 详细

OpenGL glFlush and glFinish

时间:2014-07-23 13:24:46      阅读:273      评论:0      收藏:0      [点我收藏+]

Similar to computer IO buffer, OpenGL commands are not executed immediately. 

All commands are stored in buffers first, including network buffers and the graphics 

accelerator itself, and are awaiting execution until buffers are full. For example, if

 an application runs over the network, it is much more efficient to send a collection

 of commands in a single packet than to send each command over network one at a time.


glFlush() empties all commands in these buffers and forces all pending commands

 will to be executed immediately without waiting buffers are full. 

Therefore glFlush() guarantees that all OpenGL commands made up to that point 

will complete executions in a finite amount time after calling glFlush().

 And glFlush() does not wait until previous executions are complete and may return

 immediately to your program. So you are free to send more commands even though 

previously issued commands are not finished.


glFinish() flushes buffers and forces commands to begin execution as glFlush() does,

 but glFinish() blocks other OpenGL commands and waits for all execution is complete. 

Consequently, glFinish() does not return to your program until all previously called 

commands are complete. It might be used to synchronize tasks or to measure exact 

elapsed time that certain OpenGL commands are executed.


所以两个命令都是使命令缓存中的指令立即执行并清空缓存,

只是glFlush()立即返回,而glFinish()等到指令执行完成之后才返回。

OpenGL glFlush and glFinish

原文:http://blog.csdn.net/aganlengzi/article/details/38057913

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!