Alpha Blending?

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
DevBug
Prole
Posts: 8
Joined: Sun Mar 06, 2011 1:34 am

Alpha Blending?

Post by DevBug »

I'm new to Love2D; but not to programming. I want to know if I can have more control over alpha blending. It doesn't matter to much to me because I can probably produce the effect I am looking for without full control. All I found was BlendMode.
User avatar
Taehl
Dreaming in associative arrays
Posts: 1025
Joined: Mon Jan 11, 2010 5:07 am
Location: CA, USA
Contact:

Re: Alpha Blending?

Post by Taehl »

You can set the alpha of anything by using love.graphics.setColor(r,g,b,a). Also, Love fully supports .png images with alpha.

Also, welcome to the framework and the community.
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
DevBug
Prole
Posts: 8
Joined: Sun Mar 06, 2011 1:34 am

Re: Alpha Blending?

Post by DevBug »

Thanks, Taehl. I'm afraid that I didn't make myself clear. I will probably extend love when I need to implement lighting.

I'm thinking that I'll implement it like:

Lua

Code: Select all

love.graphics.setBlendState('func', 'always')
love.graphics.setBlendState('src', 'zero')
love.graphics.setBlendState('dst', 'srcAlpha')
DirectX (I know Love uses OpenGL)

Code: Select all

Device->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
Device->SetRenderState(D3DRS_SRCBLENDALPHA, D3DBLEND_ZERO);
Device->SetRenderState(D3DRS_DESTBLENDALPHA, D3DBLEND_SRCALPHA);
Device->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_ALWAYS);
Here: love.graphics.setBlendFunc.
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests