OpenGL Alpha Channels?

Is it possible to mix with one alpha channel per component (one for red, one for green and one for blue) with OpenGL? If not, what are the possible workarounds?

+4
source share
4 answers

This is not something that is directly supported. This is pretty easy to achieve on your own, though:

  • Mark your triangle (or something else) using a 3-channel alpha texture and glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_COLOR)
  • Enable multitexturing and adjust the alpha texture to modulate the rgb texture.
  • Mark your triangle with glBlendFunc(GL_ONE, GL_ONE)
+2
source

You can do this using the pixel shader, but you will need to find a way to store / access the alpha values ​​of the components. You can save them in a texture and process regular color components as alpha values ​​for the corresponding color.

What effect / output are you trying to achieve?

+1
source

What you are describing is not possible with OpenGL.

However, given that you are new to OpenGL, maybe what you are describing is not exactly what you are after?

Mixing is a step that happens when you decide what color your current fragment should have (usually a triangle). This color must be combined with the previous color in the frame buffer. Are you sure you are after?

0
source

You are probably looking for: GL_ARB_blend_func_extended

0
source

Source: https://habr.com/ru/post/1309551/


All Articles