Replace GL.GL_LINES with glPolygonMode(..., GL.GL_LINE)
glPolygonMode is affected by polygon offset, GL.GL_LINES is not
This commit is contained in:
parent
c2f128efe6
commit
32342161fc
@ -299,14 +299,16 @@ class SelectionCursorRenderNode(rendernode.RenderNode):
|
||||
alpha = 0.3
|
||||
box = BoundingBox(point, (1, 1, 1))
|
||||
|
||||
with gl.glPushAttrib(GL.GL_DEPTH_BUFFER_BIT | GL.GL_ENABLE_BIT):
|
||||
with gl.glPushAttrib(GL.GL_DEPTH_BUFFER_BIT | GL.GL_ENABLE_BIT | GL.GL_POLYGON_BIT):
|
||||
GL.glDepthMask(False)
|
||||
GL.glEnable(GL.GL_BLEND)
|
||||
GL.glPolygonOffset(DepthOffset.SelectionCursor, DepthOffset.SelectionCursor)
|
||||
|
||||
# Wire box
|
||||
GL.glColor(1., 1., 1., alpha)
|
||||
cubes.drawBox(box, cubeType=GL.GL_LINES)
|
||||
GL.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_LINE)
|
||||
|
||||
cubes.drawBox(box)
|
||||
|
||||
# Highlighted face
|
||||
GL.glColor(r, g, b, alpha)
|
||||
|
@ -271,22 +271,27 @@ class SelectionBoxRenderNode(rendernode.RenderNode):
|
||||
with gl.glPushAttrib(GL.GL_DEPTH_BUFFER_BIT | GL.GL_ENABLE_BIT | GL.GL_POLYGON_BIT):
|
||||
GL.glDepthMask(False)
|
||||
GL.glEnable(GL.GL_BLEND)
|
||||
GL.glEnable(GL.GL_POLYGON_OFFSET_LINE)
|
||||
GL.glPolygonOffset(self.sceneNode.depth, self.sceneNode.depth)
|
||||
|
||||
GL.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_LINE)
|
||||
|
||||
if self.sceneNode.filled:
|
||||
# Filled box
|
||||
GL.glColor(r, g, b, alpha)
|
||||
cubes.drawBox(box)
|
||||
|
||||
if self.sceneNode.wire:
|
||||
# Wire box, thinner behind terrain
|
||||
# Wire box, in front of terrain
|
||||
r, g, b, alpha = self.sceneNode.wireColor
|
||||
GL.glColor(r, g, b, alpha)
|
||||
GL.glLineWidth(2.0)
|
||||
cubes.drawBox(box, cubeType=GL.GL_LINES)
|
||||
GL.glLineWidth(3.0)
|
||||
cubes.drawBox(box)
|
||||
# Wire box, behind terrain, thinner
|
||||
GL.glDisable(GL.GL_DEPTH_TEST)
|
||||
GL.glColor(r, g, b, alpha * 0.5)
|
||||
GL.glLineWidth(1.0)
|
||||
cubes.drawBox(box, cubeType=GL.GL_LINES)
|
||||
cubes.drawBox(box)
|
||||
|
||||
class SelectionBoxNode(scenenode.Node):
|
||||
RenderNodeClass = SelectionBoxRenderNode
|
||||
|
Reference in New Issue
Block a user