glDrawBuffer(GL_NONE) vs glColorMask set to all GL_FALSE

北战南征 提交于 2021-02-10 20:00:24

问题


What is the difference between glDrawBuffer(GL_NONE) and glColorMask(GL_FALSE,GL_FALSE,GL_FALSE,GL_FALSE)

Are both just another way of discarding any draws to color buffers? or there are some differences?


回答1:


First and foremost, glDrawBuffer (...) applies to the current framebuffer only, it is a per-FBO state.

glColorMask (...), on the other hand, is a global state that masks writes from per-fragment operations to all logical framebuffers.

Another problem with glColorMask (...) is that it indiscriminately applies to all draw buffers, there is a new variant of this function that can mask individual draw buffers called glColorMaski (...).

glColorMask (...) also does not apply to glBlitFramebuffer (...), as evidenced below.

OpenGL 4.4 Core Profile Specification - 18.3. Copying Pixels - pp. 485

When values are written to the draw buffers, blit operations bypass most of the fragment pipeline. The only fragment operations which affect a blit are the pixel ownership test, the scissor test, and sRGB conversion (see section 17.3.9). Color, depth, and stencil masks (see section 17.4.2) are ignored.


It would really help if you gave some context, to narrow down the full set of differences. But the bottom line is that these states affect different sets of operations and are also stored in different places.


回答2:


I think the result is the same but conceptually they're different in implementation. I'd be worried that using glColorMask for this wouldn't stop the subsystem from processing all of the incoming colors, only to not actually draw anything.



来源:https://stackoverflow.com/questions/23769518/gldrawbuffergl-none-vs-glcolormask-set-to-all-gl-false

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!