Setting blend mode?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
motorfreak
Posts: 21
Joined: Thu Feb 20, 2014 7:39 pm

Setting blend mode?

Post by motorfreak »

Need to set GL_ONE, GL_DST_COLOR for the whole scene before rendering.

how can I do this?

(background: want to add a pass over an existing pass currently in the frambuffer)
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Setting blend mode?

Post by hendu »

Set the override material to that, that's what it's there for :)
motorfreak
Posts: 21
Joined: Thu Feb 20, 2014 7:39 pm

Re: Setting blend mode?

Post by motorfreak »

Doesn't seem to work for me. I tried this:

driver->getOverrideMaterial().Enabled = true;
driver->getOverrideMaterial().EnableFlags = 0xffff;
driver->getOverrideMaterial().Material.BlendOperation = video::EBO_ADD;

I just get the second image. No blending.
motorfreak
Posts: 21
Joined: Thu Feb 20, 2014 7:39 pm

Re: Setting blend mode?

Post by motorfreak »

I was only able to make it work by adding glEnable(GL_BLEND) and glBlendFunc(GL_ONE, GL_ONE) in the draw2DImage method of video driver right before glBegin(GL_QUAD). I would guess that irrlicht should set the blend mode if I set EBO_ADD as material BlendOperation for the 2D material, but the code that sets the blend states in the setBasicRender state seems to have no effect.

#if defined(GL_EXT_blend_subtract) || defined(GL_EXT_blend_minmax) || defined(GL_EXT_blend_logic_op)
extGlBlendEquation(GL_FUNC_ADD_EXT);
#elif defined(GL_VERSION_1_2)
extGlBlendEquation(GL_FUNC_ADD);
#endif

Even if I add glBlend() stuff here, it does run, but has no effect. I suppose the blend state is reset somewhere else or something. Hmm.
motorfreak
Posts: 21
Joined: Thu Feb 20, 2014 7:39 pm

Re: Setting blend mode?

Post by motorfreak »

Quick update: I saw it disable glBlend if there was no alpha channel right after calling setBasicRenderState.. the gl driver is buggy. Getting one step closer to making this stuff work. :)

and I have still to figure out why it uses extGlBlendEquation (which doesn't work) instead of just calling glBlendFunc().
Post Reply