glDrawBuffer(GL_NONE)vs glColorMask设置为全部GL_FALSE [英] glDrawBuffer(GL_NONE) vs glColorMask set to all GL_FALSE

查看:122
本文介绍了glDrawBuffer(GL_NONE)vs glColorMask设置为全部GL_FALSE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

glDrawBuffer(GL_NONE)和glColorMask(GL_FALSE,GL_FALSE,GL_FALSE,GL_FALSE)有什么区别

这是否是丢弃对颜色缓冲区进行绘制的另一种方法?还是有些差异?

解决方案

首先, glDrawBuffer(...)适用于 current strong>仅帧缓冲,它是每个FBO状态.

另一方面,

glColorMask(...)是一种全局状态,可屏蔽从每个片段操作到所有逻辑帧缓冲区的写入.

glColorMask(...)的另一个问题是,它不加选择地应用于 all 绘制缓冲区,对此有一个新的变体可以屏蔽称为 glColorMaski(...)的单个绘制缓冲区的函数.

glColorMask(...)也不适用于 glBlitFramebuffer(...),如下所示.

OpenGL 4.4核心配置文件规范- 18.3.复制像素-第485页

将值写入绘图缓冲区时,blit操作会绕过大多数片段流水线.唯一会影响blit的片段操作是像素所有权测试,剪刀测试和sRGB转换(请参阅第17.3.9节). 颜色,深度和模板遮罩(请参见第17.4.2节)被忽略.


如果您提供一些背景信息,缩小所有差异的范围确实会有所帮助.但最重要的是,这些状态会影响不同的操作集,并且也会存储在不同的位置.>

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?

解决方案

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.

这篇关于glDrawBuffer(GL_NONE)vs glColorMask设置为全部GL_FALSE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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