Page 1 of 1

Transparency issues

Posted: 02 Aug 2012, 13:02
by Cubex
I'm making a game and it have circles in ground for some special units, the problem comes that those circles are semi-transparent, but when they overlap, the overlaped area is more opaque... what i want to archivere is getting all circles, even when they overlap, to maintain the same alpha level

What i get in red, what i want in green:
http://imageshack.us/photo/my-images/339/targety.png

http://imageshack.us/f/706/screen00002c.png

Re: Transparency issues

Posted: 02 Aug 2012, 13:23
by Google_Frog
Check out the function HighlightPylons in this gadget and then gl.Utilities.DrawGroundCircle.

Re: Transparency issues

Posted: 02 Aug 2012, 13:36
by Cubex
i tried that and i talked about it with jK but the result is "almost" same

EDIT

im going to check again when i finish rewriting my gadget, until that i cant test

Re: Transparency issues

Posted: 25 Sep 2012, 23:14
by Cubex
Resurrection finished... Returning to base..., before yeling me that this is a old thread, i dont want to open a new thread for the same topic...

After the long time i returned with the ground circle thing, and after much time :oops: i cant solve this...
screen00008.png
my nightmares
(1.51 MiB) Downloaded 3 times
As you can see in the image, when the circles overlap their alpha gets added :(

Code: Select all

local cylinder = gl.CreateList(GG.GL_Utilities.DrawMyCylinder,0,0,0,1,1,16)
local function DrawCircles()
	local minheight, maxheight = spGetGroundExtremes()
	for _, node in spairs(SYNCED.NodeList) do
		if (node.type == "node" and node.ready) or (node.type == "citadel" and node.landed) then
			local r,g,b = spGetTeamColor(spGetUnitTeam(node.id))
			gl.Color(r, g, b, GROUND_ALPHA)
			local x,y,z = spGetUnitPosition(node.id)
			local radius = node.area
			gl.PushMatrix()
			gl.Translate(x, minheight, z)
            gl.Scale(radius, (maxheight-minheight)*3 , radius)
            GG.GL_Utilities.DrawVolume(cylinder)
			gl.PopMatrix()
		end
	end
end

function gadget:DrawWorldPreUnit()
	if NodeChange or not CircleList or not LinkList then
		if (CircleList) then
			glDeleteList(CircleList)
		end
		CircleList = glCreateList(DrawCircles)
		NodeChange = false
	end
	gl.CallList(CircleList)
end