Paranormal activities (no, just a simple GL problem)

Paranormal activities (no, just a simple GL problem)

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

Post Reply
User avatar
Cubex
Posts: 56
Joined: 11 Jul 2012, 00:07

Paranormal activities (no, just a simple GL problem)

Post by Cubex »

Well, after messing a bit with GL, i can't find how to solve this problem
the img
the img
screen00007.png (91.74 KiB) Viewed 595 times
You can see how the link is visible trough terrain...

Code: Select all

local function DrawLinks()
	--Give Color to Link
	local r, g, b = 0, 1, 1
	glColor(r, g, b, LINK_ALPHA)
	for _, node in spairs(SYNCED.NodeList) do
		parent = node.parent or {}
		if node.ready and parent.ready then
			Visible = Spring.IsUnitVisible(node.id, 30, false)
			if Visible then
				--Calculate positions
				local ux, uy, uz, ud, ox, oy, oz, od = CalcLink(node.id, parent.id)
				--Let's draw links betwen nodes
				gl.BeginEnd(GL_TRIANGLE_STRIP, DrawLink, ux, uy, uz, ud, ox, oy, oz, od, 1)
			end
		end
	end
	glColor(1, 1, 1, 1)
end
What im doing wrong? :)
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: Paranormal activities (no, just a simple GL problem)

Post by Beherith »

glDepthMask(false)
glDepthTest(true)

or try different combos of true and false to see which works for you.
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: Paranormal activities (no, just a simple GL problem)

Post by Beherith »

Ping, more info:

Code: Select all

--enabling both test and mask means they wont be drawn over cliffs when obscured
			--but also means that they will flicker cause of z-fighting when scrolling around...
			--and ESPECIALLY when overlapping
		-- mask=false and test=true is perfect, no overlap flicker, no cliff overdraw
			--BUT it clips into cliffs from the side....
From projectile lights.

So you need mask=false and test=true
User avatar
Cubex
Posts: 56
Joined: 11 Jul 2012, 00:07

Re: Paranormal activities (no, just a simple GL problem)

Post by Cubex »

Thanks Beherith, now works flawlessly :mrgreen:
Post Reply

Return to “Game Development”