opengl 反转帧缓冲区像素

发布于 2024-08-28 20:30:47 字数 289 浏览 2 评论 0原文

我想知道反转帧缓冲区中颜色像素的最佳方法是。我知道可以使用 glReadPixels()glDrawPixels() 但这些调用对性能的影响相当大。

基本上,我想做的是有一个倒置的彩色十字线,无论它后面是什么,它总是可见的。例如,我有一个任意的 alpha 掩码位图或纹理,在绘制场景后无需进行深度测试即可渲染它,并且纹理的掩码(全 alpha)像素下的所有帧缓冲区像素都将被反转。

我一直在尝试用纹理来做到这一点,但我得到了一些奇怪的结果,而且所有混合选项我仍然感到困惑。

I was wondering was the best way to invert the color pixels in the frame buffer is. I know it's possible to do with glReadPixels() and glDrawPixels() but the performance hit of those calls is pretty big.

Basically, what I'm trying to do is have an inverted color cross-hair which is always visible no matter what's behind it. For instance, I'd have an arbitrary alpha mask bitmap or texture, have it render without depth test after the scene is drawn, and all the frame buffer pixels under the masked (full alpha) pixels of the texture would be inverted.

I've been trying to do this with a texture, but I'm getting some strange results, also all the blending options I still find confusing.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

对不⑦ 2024-09-04 20:30:52

尝试一下这个

glEnable(GL_COLOR_LOGIC_OP);
glLogicOp(GL_XOR);
// render geometry
glDisable(GL_COLOR_LOGIC_OP);

Give something like this a try:

glEnable(GL_COLOR_LOGIC_OP);
glLogicOp(GL_XOR);
// render geometry
glDisable(GL_COLOR_LOGIC_OP);
忘你却要生生世世 2024-09-04 20:30:52

怎么样:

glEnable (GL_BLEND); 
glBlend (GL_ONE_MINUS_DST_COLOR, GL_ZERO);

how about:

glEnable (GL_BLEND); 
glBlend (GL_ONE_MINUS_DST_COLOR, GL_ZERO);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文