Python bgl.glVertex3f() Examples

The following are 24 code examples of bgl.glVertex3f(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module bgl , or try the search function .
Example #1
Source File: space_view3d_enhanced_3d_cursor.py    From Fluid-Designer with GNU General Public License v3.0 6 votes vote down vote up
def draw_offset(self, context):
        bgl.glShadeModel(bgl.GL_SMOOTH)

        tfm_operator = CursorDynamicSettings.active_transform_operator

        bgl.glBegin(bgl.GL_LINE_STRIP)

        if tfm_operator:
            p = tfm_operator.particles[0]. \
                get_initial_matrix().to_translation()
        else:
            p = self.get_pos(self.last_id)
        bgl.glColor4f(1.0, 0.75, 0.5, 1.0)
        bgl.glVertex3f(p[0], p[1], p[2])

        p = get_cursor_location(v3d=context.space_data)
        bgl.glColor4f(1.0, 1.0, 0.25, 1.0)
        bgl.glVertex3f(p[0], p[1], p[2])

        bgl.glEnd()

# ===== BOOKMARK ===== # 
Example #2
Source File: display.py    From phobos with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def draw_joint(joint, length):
    """

    Args:
      joint: 
      length: 

    Returns:

    """
    origin = Vector(joint.matrix_world.to_translation())
    axis = joint.matrix_world * (length * joint.data.bones[0].vector.normalized())
    endpoint = axis

    bgl.glColor4f(0.0, 1.0, 0.0, 0.5)
    bgl.glLineWidth(2)
    bgl.glBegin(bgl.GL_LINE_STRIP)
    bgl.glVertex3f(*origin)
    bgl.glVertex3f(*endpoint)
    bgl.glEnd() 
Example #3
Source File: space_view3d_enhanced_3d_cursor.py    From Fluid-Designer with GNU General Public License v3.0 6 votes vote down vote up
def draw_arrow(p0, x, y, z, n_scl=0.2, ort_scl=0.035):
    p1 = p0 + z

    bgl.glBegin(bgl.GL_LINE_STRIP)
    bgl.glVertex3f(p0[0], p0[1], p0[2])
    bgl.glVertex3f(p1[0], p1[1], p1[2])
    bgl.glEnd()

    p2 = p1 - z * n_scl
    bgl.glBegin(bgl.GL_TRIANGLE_FAN)
    bgl.glVertex3f(p1[0], p1[1], p1[2])
    p3 = p2 + (x + y) * ort_scl
    bgl.glVertex3f(p3[0], p3[1], p3[2])
    p3 = p2 + (-x + y) * ort_scl
    bgl.glVertex3f(p3[0], p3[1], p3[2])
    p3 = p2 + (-x - y) * ort_scl
    bgl.glVertex3f(p3[0], p3[1], p3[2])
    p3 = p2 + (x - y) * ort_scl
    bgl.glVertex3f(p3[0], p3[1], p3[2])
    p3 = p2 + (x + y) * ort_scl
    bgl.glVertex3f(p3[0], p3[1], p3[2])
    bgl.glEnd() 
Example #4
Source File: utilities.py    From object_alignment with GNU General Public License v3.0 6 votes vote down vote up
def draw_3d_points_revised(context, points, color, size):
    region = context.region
    region3d = context.space_data.region_3d


    region_mid_width = region.width / 2.0
    region_mid_height = region.height / 2.0

    perspective_matrix = region3d.perspective_matrix.copy()

    bgl.glColor4f(*color)
    bgl.glPointSize(size)
    bgl.glBegin(bgl.GL_POINTS)

    for vec in points:

        vec_4d = perspective_matrix * vec.to_4d()
        if vec_4d.w > 0.0:
            x = region_mid_width + region_mid_width * (vec_4d.x / vec_4d.w)
            y = region_mid_height + region_mid_height * (vec_4d.y / vec_4d.w)
            bgl.glVertex3f(x, y, 0)
    bgl.glEnd() 
Example #5
Source File: mi_curve_test.py    From mifthtools with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def mi_curve_draw_3d_polyline(points, p_size, p_col, x_ray):
    bgl.glEnable(bgl.GL_BLEND)
    bgl.glLineWidth(1)

    if x_ray is True:
        bgl.glDisable(bgl.GL_DEPTH_TEST)

    bgl.glPointSize(p_size)
#    bgl.glBegin(bgl.GL_LINE_LOOP)
    bgl.glBegin(bgl.GL_LINE_STRIP)
    bgl.glColor4f(p_col[0], p_col[1], p_col[2], p_col[3])
 #   bgl.glBegin(bgl.GL_POLYGON)

    for point in points:
        bgl.glVertex3f(point[0], point[1], point[2])

    if x_ray is True:
        bgl.glEnable(bgl.GL_DEPTH_TEST)

    bgl.glEnd()

    # restore opengl defaults
    bgl.glLineWidth(1)
    bgl.glDisable(bgl.GL_BLEND)
    bgl.glColor4f(0.0, 0.0, 0.0, 1.0) 
Example #6
Source File: skeleton_ui_draw.py    From object_alignment with GNU General Public License v3.0 6 votes vote down vote up
def draw_circle(self, world_loc, radius, inner_ratio, color_outside, color_inside):
        bgl.glDepthRange(0, 0.9999)     # squeeze depth just a bit
        bgl.glEnable(bgl.GL_BLEND)
        bgl.glDepthMask(bgl.GL_FALSE)   # do not overwrite depth
        bgl.glEnable(bgl.GL_DEPTH_TEST)
        bgl.glDepthFunc(bgl.GL_LEQUAL)  # draw in front of geometry

        circleShader.enable()
        self.drawing.point_size(2.0 * radius)
        circleShader['uMVPMatrix'] = self.drawing.get_view_matrix_buffer()
        circleShader['uInOut']     = inner_ratio

        bgl.glBegin(bgl.GL_POINTS)
        circleShader['vOutColor'] = color_outside
        circleShader['vInColor']  = color_inside
        bgl.glVertex3f(*world_loc)
        bgl.glEnd()

        circleShader.disable()

        bgl.glDepthFunc(bgl.GL_LEQUAL)
        bgl.glDepthRange(0.0, 1.0)
        bgl.glDepthMask(bgl.GL_TRUE) 
Example #7
Source File: skeleton_ui_draw.py    From object_alignment with GNU General Public License v3.0 6 votes vote down vote up
def draw3d_polyline(points, color, thickness, view_loc, view_ortho, stipple=False, zfar=0.997):
    if not points: return
    if stipple:
        bgl.glLineStipple(4, 0x5555)  #play with this later
        bgl.glEnable(bgl.GL_LINE_STIPPLE)
    bgl.glEnable(bgl.GL_BLEND)
    bgl.glColor4f(*color)
    bgl.glLineWidth(thickness)
    set_depthrange(0.0, zfar, points, view_loc, view_ortho)
    bgl.glBegin(bgl.GL_LINE_STRIP)
    for coord in points: bgl.glVertex3f(*coord)
    bgl.glEnd()
    bgl.glLineWidth(1)
    if stipple:
        bgl.glDisable(bgl.GL_LINE_STIPPLE)
        bgl.glEnable(bgl.GL_BLEND)  # back to uninterrupted lines 
Example #8
Source File: mi_widget_curve.py    From mifthtools with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def draw_3d_polyline(points, p_size, p_col, x_ray):
    bgl.glEnable(bgl.GL_BLEND)
    bgl.glLineWidth(1)

    if x_ray is True:
        bgl.glDisable(bgl.GL_DEPTH_TEST)

    bgl.glPointSize(p_size)
#    bgl.glBegin(bgl.GL_LINE_LOOP)
    bgl.glBegin(bgl.GL_LINE_STRIP)
    bgl.glColor4f(p_col[0], p_col[1], p_col[2], p_col[3])
 #   bgl.glBegin(bgl.GL_POLYGON)

    for point in points:
        bgl.glVertex3f(point[0], point[1], point[2])

    if x_ray is True:
        bgl.glEnable(bgl.GL_DEPTH_TEST)

    bgl.glEnd()

    # restore opengl defaults
    bgl.glLineWidth(1)
    bgl.glDisable(bgl.GL_BLEND)
    bgl.glColor4f(0.0, 0.0, 0.0, 1.0) 
Example #9
Source File: mi_curve_test.py    From mifthtools with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def mi_curve_draw_3d_polyline(points, p_size, p_col, x_ray):
    bgl.glEnable(bgl.GL_BLEND)
    bgl.glLineWidth(1)

    if x_ray is True:
        bgl.glDisable(bgl.GL_DEPTH_TEST)

    bgl.glPointSize(p_size)
#    bgl.glBegin(bgl.GL_LINE_LOOP)
    bgl.glBegin(bgl.GL_LINE_STRIP)
    bgl.glColor4f(p_col[0], p_col[1], p_col[2], p_col[3])
 #   bgl.glBegin(bgl.GL_POLYGON)

    for point in points:
        bgl.glVertex3f(point[0], point[1], point[2])

    if x_ray is True:
        bgl.glEnable(bgl.GL_DEPTH_TEST)

    bgl.glEnd()

    # restore opengl defaults
    bgl.glLineWidth(1)
    bgl.glDisable(bgl.GL_BLEND)
    bgl.glColor4f(0.0, 0.0, 0.0, 1.0) 
Example #10
Source File: mi_curve_test.py    From mifthtools with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def draw_callback_px_2d(self, context):

    # 50% alpha, 2 pixel width line
    bgl.glEnable(bgl.GL_BLEND)
    bgl.glColor4f(1.0, 1.0, 1.0, 0.5)
    bgl.glLineWidth(2)

   # bgl.glBegin(bgl.GL_LINE_STRIP)
   # bgl.glVertex3f(*ob.matrix_world.translation)
   # bgl.glVertex3f(*context.scene.cursor_location)
   # bgl.glEnd()

    #bgl.glBegin(bgl.GL_POLYGON)
    ##bgl.glColor4f(0.0, 0.0, 0.0, 0.5)
    #bgl.glVertex3f(0.0, 0.0, 0.0)
    #bgl.glVertex3f(0.0, 1.0, 0.0)
    #bgl.glVertex3f(1.0, 1.0, 0.0)
    #bgl.glVertex3f(1.0, 0.0, 0.0)
    #bgl.glEnd()

    #bgl.glEnable(bgl.GL_BLEND)
    #bgl.glLineWidth(1.5)
    bgl.glPointSize(4)
#    bgl.glBegin(bgl.GL_LINE_LOOP)
    bgl.glBegin(bgl.GL_POINTS)
 #   bgl.glBegin(bgl.GL_POLYGON)
    bgl.glColor4f(0.5,1.1,1.0,0.5)
    bgl.glVertex2f(10, 20)
    bgl.glVertex2f(50,60)
    bgl.glVertex2f(700,80)
    bgl.glVertex2f(2,180)
    bgl.glEnd()

    # restore opengl defaults
    bgl.glLineWidth(1)
    bgl.glDisable(bgl.GL_BLEND)
    bgl.glColor4f(0.0, 0.0, 0.0, 1.0) 
Example #11
Source File: display.py    From phobos with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def draw_path(path, color=colors['white'], dim3=False, width=4):
    """

    Args:
      path: 
      color: (Default value = colors['white'])
      dim3: (Default value = False)
      width: (Default value = 4)

    Returns:

    """
    origins = []
    for e in range(len(path)):
        origins.append(path[e].matrix_world.to_translation())

    bgl.glEnable(bgl.GL_BLEND)
    bgl.glLineWidth(width)

    bgl.glBegin(bgl.GL_LINE_STRIP)
    bgl.glColor4f(*color)
    for o in origins:
        if dim3:
            bgl.glVertex3f(o)
        else:
            bgl.glVertex2f(*to2d(o))
    bgl.glEnd()
    bgl.glDisable(bgl.GL_BLEND) 
Example #12
Source File: display.py    From phobos with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def draw_2dpolygon(points, linecolor=None, fillcolor=None, distance=0.2, linewidth=1):
    """

    Args:
      points: 
      linecolor: (Default value = None)
      fillcolor: (Default value = None)
      distance: (Default value = 0.2)
      linewidth: (Default value = 1)

    Returns:

    """
    # background
    bgl.glEnable(bgl.GL_BLEND)
    bgl.glLineWidth(linewidth)
    if fillcolor:
        bgl.glColor4f(*fillcolor)
        bgl.glBegin(bgl.GL_POLYGON)
        for p in points:
            bgl.glVertex3f(*p, distance)
        bgl.glEnd()
    # frame
    if linecolor:
        bgl.glColor4f(*linecolor)
        bgl.glBegin(bgl.GL_LINE_STRIP)
        for p in points:
            bgl.glVertex3f(*p, distance)
        bgl.glVertex3f(*points[0], distance)
        bgl.glEnd()
    bgl.glLineWidth(1)
    bgl.glDisable(bgl.GL_BLEND) 
Example #13
Source File: skeleton_ui_draw.py    From object_alignment with GNU General Public License v3.0 5 votes vote down vote up
def draw3d_points(points, color, size, view_loc, view_ortho, zfar=0.997):
    if not points: return
    bgl.glColor4f(*color)
    bgl.glPointSize(size)
    set_depthrange(0.0, zfar, points, view_loc, view_ortho)
    bgl.glBegin(bgl.GL_POINTS)
    for coord in points: bgl.glVertex3f(*coord)
    bgl.glEnd()
    bgl.glPointSize(1.0)

# draws polylines. 
Example #14
Source File: 3dview_play_tictactoe.py    From BAddons with GNU General Public License v3.0 5 votes vote down vote up
def drawX(self, xa, xb, ya, yb):
        bgl.glColor3f(*self.COLOR_X)
        r = xb - xa
        bgl.glVertex3f(xa + r*self.EMPTY_FACTOR, ya + r*self.EMPTY_FACTOR, 0.0)
        bgl.glVertex3f(xb - r*self.EMPTY_FACTOR, yb - r*self.EMPTY_FACTOR, 0.0)
        bgl.glVertex3f(xa + r*self.EMPTY_FACTOR, yb - r*self.EMPTY_FACTOR, 0.0)
        bgl.glVertex3f(xb - r*self.EMPTY_FACTOR, ya + r*self.EMPTY_FACTOR, 0.0) 
Example #15
Source File: 3dview_play_tictactoe.py    From BAddons with GNU General Public License v3.0 5 votes vote down vote up
def drawO(self, xa, xb, ya, yb):
        bgl.glColor3f(*self.COLOR_O)
        r = xb - xa
        bgl.glVertex3f(xa + r*self.EMPTY_FACTOR, (ya + yb)/2.0, 0.0)
        bgl.glVertex3f((xa + xb)/2.0, yb - r*self.EMPTY_FACTOR, 0.0)
        bgl.glVertex3f((xa + xb)/2.0, yb - r*self.EMPTY_FACTOR, 0.0)
        bgl.glVertex3f(xb - r*self.EMPTY_FACTOR, (ya + yb)/2.0, 0.0)
        bgl.glVertex3f(xb - r*self.EMPTY_FACTOR, (ya + yb)/2.0, 0.0)
        bgl.glVertex3f((xa + xb)/2.0, ya + r*self.EMPTY_FACTOR, 0.0)
        bgl.glVertex3f((xa + xb)/2.0, ya + r*self.EMPTY_FACTOR, 0.0)
        bgl.glVertex3f(xa + r*self.EMPTY_FACTOR, (ya + yb)/2.0, 0.0) 
Example #16
Source File: ogl_velocitiesrenderer.py    From BAddons with GNU General Public License v3.0 5 votes vote down vote up
def drawCallback(self):
        mat = self.interfacer.getBlenderObject().matrix_world
        if self.do_draw and self.interfacer.isClean():
            # isClean() is not really needed here, but it shows its
            # behavior and helps reducing (a tiny bit!) the run time...
            bgl.glColor3f(0.0, 1.0, 1.0)
            bgl.glPointSize(5)
            bgl.glBegin(bgl.GL_POINTS)
            for v in self.vertices:
                bgl.glVertex3f(*(mat*v))
            bgl.glEnd()
            bgl.glPointSize(1)

            bgl.glColor3f(1.0, 1.0, 0.0)
            bgl.glLineWidth(2)
            bgl.glBegin(bgl.GL_LINES)
            for v, w in zip(self.vertices, self.velocities):
                bgl.glVertex3f(*(mat*v))
                bgl.glVertex3f(*(mat*(v + w)))
            bgl.glEnd()
            bgl.glLineWidth(1)


# this in toplevel is also requested
# MAIN_CLASS should be set to any callable returning the
# requested instance, which provides the update() method. 
Example #17
Source File: mi_widget_curve.py    From mifthtools with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def draw_3d_polyline(points, p_size, p_col, x_ray):
    bgl.glEnable(bgl.GL_BLEND)
    bgl.glLineWidth(1)

    if x_ray is True:
        bgl.glDisable(bgl.GL_DEPTH_TEST)

    bgl.glPointSize(p_size)

    coords = [(point[0], point[1], point[2]) for point in points]
    batch = batch_for_shader(shader3d, 'LINE_STRIP', {"pos": coords})
    shader3d.bind()
    shader3d.uniform_float("color", (p_col[0], p_col[1], p_col[2], p_col[3]))
    batch.draw(shader3d)

    # bgl.glBegin(bgl.GL_LINE_STRIP)
    # bgl.glColor4f(p_col[0], p_col[1], p_col[2], p_col[3])
    # for point in points:
    #     bgl.glVertex3f(point[0], point[1], point[2])

    if x_ray is True:
        bgl.glEnable(bgl.GL_DEPTH_TEST)

    # bgl.glEnd()

    # restore opengl defaults
    bgl.glLineWidth(1)
    bgl.glDisable(bgl.GL_BLEND) 
Example #18
Source File: edit_mesh.py    From coa_tools with GNU General Public License v3.0 5 votes vote down vote up
def draw_circle(self,pos,color,size=8):
        pos = pos + Vector((0,-.1,0))
        bgl.glColor4f(color[0], color[1], color[2], 1.0)
        bgl.glPointSize(size)
        bgl.glBegin(bgl.GL_POINTS)
        bgl.glVertex3f(pos[0],pos[1],pos[2])
        bgl.glEnd() 
Example #19
Source File: mi_curve_test.py    From mifthtools with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def draw_callback_px_2d(self, context):

    # 50% alpha, 2 pixel width line
    bgl.glEnable(bgl.GL_BLEND)
    bgl.glColor4f(1.0, 1.0, 1.0, 0.5)
    bgl.glLineWidth(2)

   # bgl.glBegin(bgl.GL_LINE_STRIP)
   # bgl.glVertex3f(*ob.matrix_world.translation)
   # bgl.glVertex3f(*context.scene.cursor_location)
   # bgl.glEnd()

    #bgl.glBegin(bgl.GL_POLYGON)
    ##bgl.glColor4f(0.0, 0.0, 0.0, 0.5)
    #bgl.glVertex3f(0.0, 0.0, 0.0)
    #bgl.glVertex3f(0.0, 1.0, 0.0)
    #bgl.glVertex3f(1.0, 1.0, 0.0)
    #bgl.glVertex3f(1.0, 0.0, 0.0)
    #bgl.glEnd()

    #bgl.glEnable(bgl.GL_BLEND)
    #bgl.glLineWidth(1.5)
    bgl.glPointSize(4)
#    bgl.glBegin(bgl.GL_LINE_LOOP)
    bgl.glBegin(bgl.GL_POINTS)
 #   bgl.glBegin(bgl.GL_POLYGON)
    bgl.glColor4f(0.5,1.1,1.0,0.5)
    bgl.glVertex2f(10, 20)
    bgl.glVertex2f(50,60)
    bgl.glVertex2f(700,80)
    bgl.glVertex2f(2,180)
    bgl.glEnd()

    # restore opengl defaults
    bgl.glLineWidth(1)
    bgl.glDisable(bgl.GL_BLEND)
    bgl.glColor4f(0.0, 0.0, 0.0, 1.0) 
Example #20
Source File: mi_curve_test.py    From mifthtools with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def draw_callback_px_3d(self, context):

    # 50% alpha, 2 pixel width line
    bgl.glEnable(bgl.GL_BLEND)
    bgl.glColor4f(1.0, 1.0, 1.0, 0.5)
    bgl.glLineWidth(2)

   # bgl.glBegin(bgl.GL_LINE_STRIP)
   # bgl.glVertex3f(*ob.matrix_world.translation)
   # bgl.glVertex3f(*context.scene.cursor_location)
   # bgl.glEnd()

    bgl.glBegin(bgl.GL_POLYGON)
    #bgl.glColor4f(0.0, 0.0, 0.0, 0.5)
    bgl.glVertex3f(0.0, 0.0, 0.0)
    bgl.glVertex3f(0.0, 1.0, 0.0)
    bgl.glVertex3f(1.0, 1.0, 0.0)
    bgl.glVertex3f(1.0, 0.0, 0.0)
    bgl.glEnd()

    ##bgl.glEnable(bgl.GL_BLEND)
    ##bgl.glLineWidth(1.5)
    #bgl.glPointSize(4)
##    bgl.glBegin(bgl.GL_LINE_LOOP)
    #bgl.glBegin(bgl.GL_POINTS)
 ##   bgl.glBegin(bgl.GL_POLYGON)
    #bgl.glColor4f(0.5,1.1,1.0,0.5)
    #bgl.glVertex2f(10, 20)
    #bgl.glVertex2f(50,60)
    #bgl.glVertex2f(700,80)
    #bgl.glVertex2f(2,180)
    #bgl.glEnd()

    # restore opengl defaults
    bgl.glLineWidth(1)
    bgl.glDisable(bgl.GL_BLEND)
    bgl.glColor4f(0.0, 0.0, 0.0, 1.0) 
Example #21
Source File: cm_draw.py    From CrowdMaster with GNU General Public License v3.0 5 votes vote down vote up
def drawLine3D(color, start, end, width=1):
    bgl.glLineWidth(width)
    bgl.glColor4f(*color)
    bgl.glBegin(bgl.GL_LINES)
    bgl.glVertex3f(*start)
    bgl.glVertex3f(*end) 
Example #22
Source File: space_view3d_enhanced_3d_cursor.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def draw_line(p0, p1, c=None):
    if c is not None:
        bgl.glColor4f(c[0], c[1], c[2], \
            (c[3] if len(c) > 3 else 1.0))
    bgl.glBegin(bgl.GL_LINE_STRIP)
    bgl.glVertex3f(p0[0], p0[1], p0[2])
    bgl.glVertex3f(p1[0], p1[1], p1[2])
    bgl.glEnd() 
Example #23
Source File: space_view3d_enhanced_3d_cursor.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def draw_trace(self, context):
        bgl.glColor4f(0.75, 1.0, 0.75, 1.0)
        bgl.glBegin(bgl.GL_LINE_STRIP)
        for entry in self.entries:
            p = entry.pos
            bgl.glVertex3f(p[0], p[1], p[2])
        bgl.glEnd() 
Example #24
Source File: bmesh_render.py    From addon_common with GNU General Public License v3.0 4 votes vote down vote up
def glDrawSimpleFaces(lsf, opts=None, enableShader=True):
    opts_ = opts or {}
    nosel = opts_.get('no selection', False)
    mx = opts_.get('mirror x', False)
    my = opts_.get('mirror y', False)
    mz = opts_.get('mirror z', False)
    dn = opts_.get('normal', 0.0)

    bmeshShader.assign('focus_mult', opts_.get('focus mult', 1.0))
    bmeshShader.assign('use_selection', 0.0 if nosel else 1.0)
    bmeshShader.assign('selected', 0.0)

    @profiler.profile
    def render(sx, sy, sz):
        bmeshShader.assign('vert_scale', (sx, sy, sz))
        for sf in lsf:
            for v0, v1, v2 in triangulateFace(sf):
                (c0, n0), (c1, n1), (c2, n2) = v0, v1, v2
                bgl.glNormal3f(*n0)
                bgl.glVertex3f(*c0)
                bgl.glNormal3f(*n1)
                bgl.glVertex3f(*c1)
                bgl.glNormal3f(*n2)
                bgl.glVertex3f(*c2)

    if enableShader:
        bmeshShader.enable()

    glSetOptions('poly', opts)
    bgl.glBegin(bgl.GL_TRIANGLES)
    render(1, 1, 1)
    bgl.glEnd()
    bgl.glDisable(bgl.GL_LINE_STIPPLE)

    if mx or my or mz:
        glSetOptions('poly mirror', opts)
        bgl.glBegin(bgl.GL_TRIANGLES)
        if mx:
            render(-1,  1,  1)
        if my:
            render(1, -1,  1)
        if mz:
            render(1,  1, -1)
        if mx and my:
            render(-1, -1,  1)
        if mx and mz:
            render(-1,  1, -1)
        if my and mz:
            render(1, -1, -1)
        if mx and my and mz:
            render(-1, -1, -1)
        bgl.glEnd()
        bgl.glDisable(bgl.GL_LINE_STIPPLE)

    if enableShader:
        bmeshShader.disable()