简体   繁体   中英

OpenGL blending not working with DIB section

I'm trying to render to a DIB section with blending using OpenGL on XP. I'm trying to multiply the source and destination colour components together, as in:

glEnable(GL_BLEND);
glBlendFunc(GL_DST_COLOR, GL_ZERO);

However, it fails to draw a blended image. By changing the type of blending I ask for, I can make it draw as if without blending, or not draw at all. But it refuses to blend.

Here are details about the OpenGL version I'm using:

Vendor: Microsoft Corporation
Renderer: GDI Generic
Version: 1.1.0
Extensions: GL_WIN_swap_hint GL_EXT_bgra GL_EXT_paletted_texture

I was aware that I'm limited to “generic” (software) rendering with DIB sections, but I did not expect blending to fail. I have searched for confirmation about whether blending is or is not supported in such cases, but to no avail.

glBlendFunc(GL_DST_COLOR, GL_ZERO);
               ^^^ oh?

Transparency, Translucency, and Blending :

15.060 I want to use blending but can't get destination alpha to work. Can I blend or create a transparency effect without destination alpha?

Many OpenGL devices don't support destination alpha. In particular, the OpenGL 1.1 software rendering libraries from Microsoft don't support it. The OpenGL specification doesn't require it.

Also:

No Alpha in the Framebuffer :

If you are doing Blending and you need a destination alpha, you need to make sure that your render target has one. This is easy to ensure when rendering to a Framebuffer Object. But with a Default Framebuffer, it depends on how you created your OpenGL Context.

For example, if you are using GLUT, you need to make sure you pass GLUT_ALPHA to the glutInitDisplayMode function.

Ok I made a silly mistake: I misread my own script code and ended up applying the texture in the wrong rendering pass. OpenGL wasn't to blame, and blending DOES work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM