本文整理汇总了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()
示例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
示例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)
示例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)
示例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
示例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)
示例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)