How can I do a "mask" or blendmode union ?

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
TsT
Party member
Posts: 161
Joined: Thu Sep 25, 2008 7:04 pm
Location: France
Contact:

How can I do a "mask" or blendmode union ?

Post by TsT »

Hello,

I'm searching to know (if it's possible) how draw multiple form with semi-transparent color without additive at all.
at left what I have ; at right what I want
at left what I have ; at right what I want
iwanna.png (3.63 KiB) Viewed 4361 times
.

I tried with setColorMode() and setBlendMode() but without success as you can see at this sample :
blendmode.zip
(3.44 KiB) Downloaded 215 times
Somebody has a idea ?
My projects current projects : dragoon-framework (includes lua-newmodule, lua-provide, lovemodular, , classcommons2, and more ...)
User avatar
rude
Administrator
Posts: 1052
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

Re: How can I do a "mask" or blendmode union ?

Post by rude »

I also totally want that, so if someone knows how to do it, I'll include it in the next version.
User avatar
Damnae
Prole
Posts: 12
Joined: Sun Oct 05, 2008 12:33 pm

Re: How can I do a "mask" or blendmode union ?

Post by Damnae »

You could draw two circles on a render target without additive mode, and then draw a square with that texture and additive mode on the backbuffer ...
(I think a render target is called a framebuffer in opengl)
User avatar
rude
Administrator
Posts: 1052
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

Re: How can I do a "mask" or blendmode union ?

Post by rude »

Clever, but will have to wait a while for that. 8-)
User avatar
muku
Prole
Posts: 18
Joined: Wed Aug 20, 2008 11:35 am

Re: How can I do a "mask" or blendmode union ?

Post by muku »

Stencil buffers could also be used for that: every render operation would write into a stencil buffer, and new fragments only get rendered where the stencil buffer has not been set yet.
Post Reply

Who is online

Users browsing this forum: No registered users and 90 guests