开发者

Render into a color channels without affecting other channels

开发者 https://www.devze.com 2023-02-22 18:21 出处:网络
Using OpenGL (any version), how can I render into a frame buffer object by only affecting one color channel at a time?

Using OpenGL (any version), how can I render into a frame buffer object by only affecting one color channel at a time?

For example my frame buffer object has GL_BGRA layout. Now I want to execute some rendering commands which should only change the red channel. So if the a fragment would be rendered with color (204,0,0,0) and the pixel currenlty has the color (18,0,100,99) the result should be (204,0,100,99). This should work for all channels (at least for BGR). Is there perhaps some kind of mask 开发者_Python百科command?


Yep, it's called glColorMask:

Specify whether red, green, blue, and alpha can or cannot be written into the frame buffer. The initial values are all GL_TRUE, indicating that the color components can be written

(from http://www.opengl.org/sdk/docs/man/xhtml/glColorMask.xml)

0

精彩评论

暂无评论...
验证码 换一张
取 消