Python bgl.glLineStipple() Examples
The following are 7
code examples of bgl.glLineStipple().
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: archipack_gl.py From archipack with GNU General Public License v3.0 | 6 votes |
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()
Example #2
Source File: skeleton_ui_draw.py From object_alignment with GNU General Public License v3.0 | 6 votes |
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 #3
Source File: drawing.py From addon_common with GNU General Public License v3.0 | 5 votes |
def enable_stipple(self): bgl.glLineStipple(4, 0x5555) bgl.glEnable(bgl.GL_LINE_STIPPLE)
Example #4
Source File: bmesh_render.py From addon_common with GNU General Public License v3.0 | 5 votes |
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)
Example #5
Source File: skeleton_ui_draw.py From object_alignment with GNU General Public License v3.0 | 5 votes |
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
Example #6
Source File: mi_widget_select.py From mifthtools with BSD 3-Clause "New" or "Revised" License | 4 votes |
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)
Example #7
Source File: node_colorramp_dropper.py From BAddons with GNU General Public License v3.0 | 4 votes |
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)