Render primitives using render library without depth

The render.DrawLine function has this as an argument, the last argument “writeZ” which decides whether or not to write to the depth buffer. This works exactly how I want it to work, but I need to draw a Quad rather than a line. DrawQuad or DrawQuadEasy doesn’t have that argument. I’ve tried using render.OverrideDepthBuffer, but it doesn’t seem to work.



render.OverrideDepthEnable(true)

render.SetMaterial(mat)
render.DrawQuadEasy(self:GetPos(), Vector(0, 0, 1), 100, 100, Color(255, 255, 255), 0)

render.OverrideDepthEnable(false)


The quad needs to draw ontop of the world, ignoring the depth buffer.

//Edit: I should probably mention, I am rendering this in the entity’s Draw function, but I have also tried to draw it in PostDrawOpaqueRenderables.
I can think of one way of making this work, which is to create a 3d context, but that just seems hacky and there has to be another way.

cam.IgnoreZ(true)

I thought that was only usable while in a user-created 3D context. But then again, there’s 3D contexts everywhere.
Thanks, it works perfectly now!

[editline]8th August 2015[/editline]

Alright, I was wrong. It works, but not “perfectly”. The quad draw above my viewmodel, which isn’t exactly what I want. I need to be able to draw on top of the world, but not the viewmodel or entities. Is there no way to get the exact functionality that the render.DrawLine has?

//Edit: I ended up using stencils for this, which works well if you clear the stencil before drawing the quads. However, some map elements end up drawing through the wall this way, but I’ll live with that.