当前位置: 首页>>代码示例>>Python>>正文


Python bgl.glLineStipple方法代码示例

本文整理汇总了Python中bgl.glLineStipple方法的典型用法代码示例。如果您正苦于以下问题:Python bgl.glLineStipple方法的具体用法?Python bgl.glLineStipple怎么用?Python bgl.glLineStipple使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在bgl的用法示例。


在下文中一共展示了bgl.glLineStipple方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: draw

# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glLineStipple [as 别名]
def draw(self, context, render=False):
        """
            render flag when rendering
        """

        # print("draw_line %s" % (type(self).__name__))
        bgl.glPushAttrib(bgl.GL_ENABLE_BIT)
        if self.style == bgl.GL_LINE_STIPPLE:
            bgl.glLineStipple(1, 0x9999)
        bgl.glEnable(self.style)
        bgl.glEnable(bgl.GL_BLEND)
        if render:
            # enable anti-alias on lines
            bgl.glEnable(bgl.GL_LINE_SMOOTH)
        bgl.glColor4f(*self.colour)
        bgl.glLineWidth(self.width)
        if self.closed:
            bgl.glBegin(bgl.GL_LINE_LOOP)
        else:
            bgl.glBegin(bgl.GL_LINE_STRIP)

        for pt in self.pts:
            p = self.position_2d_from_coord(context, pt, render)
            bgl.glVertex2f(p.x, p.y)
        self._end() 
开发者ID:s-leger,项目名称:archipack,代码行数:27,代码来源:archipack_gl.py

示例2: draw3d_polyline

# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glLineStipple [as 别名]
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 
开发者ID:patmo141,项目名称:object_alignment,代码行数:18,代码来源:skeleton_ui_draw.py

示例3: enable_stipple

# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glLineStipple [as 别名]
def enable_stipple(self):
        bgl.glLineStipple(4, 0x5555)
        bgl.glEnable(bgl.GL_LINE_STIPPLE) 
开发者ID:CGCookie,项目名称:addon_common,代码行数:5,代码来源:drawing.py

示例4: glEnableStipple

# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glLineStipple [as 别名]
def glEnableStipple(enable=True):
    if enable:
        bgl.glLineStipple(4, 0x5555)
        bgl.glEnable(bgl.GL_LINE_STIPPLE)
    else:
        bgl.glDisable(bgl.GL_LINE_STIPPLE)


# def glEnableBackfaceCulling(enable=True):
#     if enable:
#         bgl.glDisable(bgl.GL_CULL_FACE)
#         bgl.glDepthFunc(bgl.GL_GEQUAL)
#     else:
#         bgl.glDepthFunc(bgl.GL_LEQUAL)
#         bgl.glEnable(bgl.GL_CULL_FACE) 
开发者ID:CGCookie,项目名称:addon_common,代码行数:17,代码来源:bmesh_render.py

示例5: draw2d_polyline

# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glLineStipple [as 别名]
def draw2d_polyline(points, color, thickness, stipple=False):
    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)
    bgl.glBegin(bgl.GL_LINE_STRIP)
    for coord in points: bgl.glVertex2f(*coord)
    bgl.glEnd()
    bgl.glLineWidth(1)
    if stipple:
        bgl.glDisable(bgl.GL_LINE_STIPPLE)
        bgl.glEnable(bgl.GL_BLEND)  # back to uninterupted lines 
开发者ID:patmo141,项目名称:object_alignment,代码行数:16,代码来源:skeleton_ui_draw.py

示例6: draw_box_select

# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glLineStipple [as 别名]
def draw_box_select(anchor, m_coords, region,  p_col = (0.7,0.8,1.0,0.6), enabled = False, dragging = False, sub = False):

    if enabled:
        f_col = p_col
        if sub:
            f_col = (1.0, 0.5, 0.4, 0.6)
        bgl.glEnable(bgl.GL_BLEND)
        bgl.glLineStipple(1, 0xCCCC)
        bgl.glEnable(bgl.GL_LINE_STIPPLE)

        bgl.glBegin(bgl.GL_LINES)
        bgl.glColor4f(f_col[0], f_col[1], f_col[2], f_col[3])

        point_x = m_coords[0]
        point_y = m_coords[1]

        bgl.glVertex2f(point_x,0)
        bgl.glVertex2f(point_x, region.height)

        bgl.glVertex2f(0, point_y)
        bgl.glVertex2f(region.width, point_y)

        bgl.glEnd()
        bgl.glDisable(bgl.GL_LINE_STIPPLE)
        bgl.glDisable(bgl.GL_BLEND)

        if dragging:
            bgl.glEnable(bgl.GL_BLEND)
            bgl.glBegin(bgl.GL_QUADS)
            bgl.glColor4f(f_col[0], f_col[1], f_col[2], f_col[3] / 3)
            point_x = m_coords[0]
            point_y = m_coords[1]

            anc_x = anchor[0]
            anc_y = anchor[1]

            bgl.glVertex2f(anc_x, anc_y)
            bgl.glVertex2f(point_x, anc_y)
            bgl.glVertex2f(point_x,point_y)
            bgl.glVertex2f(anc_x,point_y)
            bgl.glEnd()

            bgl.glLineStipple(1, 0xCCCC)
            bgl.glEnable(bgl.GL_LINE_STIPPLE)
            bgl.glBegin(bgl.GL_LINE_LOOP)

            bgl.glColor4f(f_col[0], f_col[1], f_col[2], f_col[3])
            bgl.glVertex2f(anc_x, anc_y)
            bgl.glVertex2f(point_x, anc_y)
            bgl.glVertex2f(point_x, point_y)
            bgl.glVertex2f(anc_x, point_y)

            bgl.glEnd()
            # restore opengl defaults
            bgl.glLineWidth(1)
            bgl.glDisable(bgl.GL_LINE_STIPPLE)
            bgl.glDisable(bgl.GL_BLEND)
            bgl.glColor4f(0.0, 0.0, 0.0, 1.0) 
开发者ID:mifth,项目名称:mifthtools,代码行数:60,代码来源:mi_widget_select.py

示例7: drawSegment

# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glLineStipple [as 别名]
def drawSegment(x1, y1, x2, y2, future=False, limit=False):
        dx = x2 - x1
        dy = y2 - y1
        if max(abs(dx), abs(dy)) < 20:
            return
        
        if future:
            alpha = 0.2
        else:
            alpha = 0.5

        if abs(dx) >= abs(dy):
            xa = x1 + sgn(dx)*10
            xb = x2 - sgn(dx)*10
            ratio = dy/abs(dx)
            ya = y1 + 10*ratio
            yb = y2 - 10*ratio
        else:
            ya = y1 + sgn(dy)*10
            yb = y2 - sgn(dy)*10
            ratio = dx/abs(dy)
            xa = x1 + 10*ratio
            xb = x2 - 10*ratio
        
        #bgl.glLineWidth(2)
        bgl.glEnable(bgl.GL_LINE_STIPPLE)
        bgl.glEnable(bgl.GL_BLEND)
        
        if limit:
            bgl.glColor4f(1.0, 0.0, 0.0, alpha)
        else:
            bgl.glColor4f(0.0, 0.0, 0.0, alpha)

        bgl.glLineStipple(1, 0x00FF)
        bgl.glBegin(bgl.GL_LINES)
        bgl.glVertex2f(xa, ya)
        bgl.glVertex2f(xb, yb)
        bgl.glEnd()
        
        bgl.glColor4f(1.0, 1.0, 1.0, alpha)

        bgl.glLineStipple(1, 0xFF00)
        bgl.glBegin(bgl.GL_LINES)
        bgl.glVertex2f(xa, ya)
        bgl.glVertex2f(xb, yb)
        bgl.glEnd()

        bgl.glLineStipple(1, 0xFFFF)
        bgl.glDisable(bgl.GL_BLEND)
        bgl.glDisable(bgl.GL_LINE_STIPPLE)
        #bgl.glLineWidth(1) 
开发者ID:qwenger,项目名称:BAddons,代码行数:53,代码来源:node_colorramp_dropper.py


注:本文中的bgl.glLineStipple方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。