本文整理汇总了Python中bgl.glDisable方法的典型用法代码示例。如果您正苦于以下问题:Python bgl.glDisable方法的具体用法?Python bgl.glDisable怎么用?Python bgl.glDisable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bgl
的用法示例。
在下文中一共展示了bgl.glDisable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: draw_line
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glDisable [as 别名]
def draw_line(p1, p2, color, shadow=False, shadow_color=None):
bgl.glEnable(bgl.GL_BLEND)
bgl.glEnable(bgl.GL_LINE_SMOOTH)
# Draw shadow.
if shadow:
bgl.glLineWidth(3.0)
bgl.glColor4f(*shadow_color, 1.0)
bgl.glBegin(bgl.GL_LINES)
bgl.glVertex2f(*p1)
bgl.glVertex2f(*p2)
bgl.glEnd()
# Draw line.
bgl.glLineWidth(1.5 if shadow else 1.0)
bgl.glColor3f(*color)
bgl.glBegin(bgl.GL_LINES)
bgl.glVertex2f(*p1)
bgl.glVertex2f(*p2)
bgl.glEnd()
bgl.glLineWidth(1.0)
bgl.glDisable(bgl.GL_LINE_SMOOTH)
示例2: draw_callback_px
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glDisable [as 别名]
def draw_callback_px(self, context):
print("mouse points", len(self.mouse_path))
font_id = 0 # XXX, need to find out how best to get this.
# draw some text
blf.position(font_id, 15, 30, 0)
blf.size(font_id, 20, 72)
blf.draw(font_id, "Hello Word " + str(len(self.mouse_path)))
# 50% alpha, 2 pixel width line
bgl.glEnable(bgl.GL_BLEND)
bgl.glColor4f(0.0, 0.0, 0.0, 0.5)
bgl.glLineWidth(2)
bgl.glBegin(bgl.GL_LINE_STRIP)
for x, y in self.mouse_path:
bgl.glVertex2i(x, y)
bgl.glEnd()
# restore opengl defaults
bgl.glLineWidth(1)
bgl.glDisable(bgl.GL_BLEND)
bgl.glColor4f(0.0, 0.0, 0.0, 1.0)
示例3: draw_callback_px
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glDisable [as 别名]
def draw_callback_px(self, context):
global cursor_save_location
settings = find_settings()
if settings is None:
return
library = settings.libraries.get_item()
tfm_operator = CursorDynamicSettings.active_transform_operator
if settings.show_bookmarks and library:
library.draw_bookmark(context)
if tfm_operator:
tfm_operator.draw_2d(context)
# restore opengl defaults
bgl.glLineWidth(1)
bgl.glDisable(bgl.GL_BLEND)
bgl.glColor4f(0.0, 0.0, 0.0, 1.0)
# ===== UTILITY FUNCTIONS ===== #
示例4: draw_callback_px
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glDisable [as 别名]
def draw_callback_px(self, context):
"""From blender's operator_modal_draw.py modal operator template"""
if self.do_draw:
bgl.glEnable(bgl.GL_BLEND)
bgl.glEnable(bgl.GL_LINE_STIPPLE)
bgl.glColor4f(0.0, 0.0, 0.0, 1.0)
bgl.glLineWidth(1)
bgl.glBegin(bgl.GL_LINE_STRIP)
bgl.glVertex2i(int(self.draw_start.x), int(self.draw_start.y))
bgl.glVertex2i(int(self.draw_end.x), int(self.draw_end.y))
bgl.glEnd()
# restore opengl defaults
bgl.glLineWidth(1)
bgl.glDisable(bgl.GL_BLEND)
bgl.glDisable(bgl.GL_LINE_STIPPLE)
bgl.glColor4f(0.0, 0.0, 0.0, 1.0)
示例5: draw_darken
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glDisable [as 别名]
def draw_darken(self):
bgl.glPushAttrib(bgl.GL_ALL_ATTRIB_BITS)
bgl.glMatrixMode(bgl.GL_PROJECTION)
bgl.glPushMatrix()
bgl.glLoadIdentity()
bgl.glColor4f(0,0,0,0.25) # TODO: use window background color??
bgl.glEnable(bgl.GL_BLEND)
bgl.glDisable(bgl.GL_DEPTH_TEST)
bgl.glBegin(bgl.GL_QUADS) # TODO: not use immediate mode
bgl.glVertex2f(-1, -1)
bgl.glVertex2f( 1, -1)
bgl.glVertex2f( 1, 1)
bgl.glVertex2f(-1, 1)
bgl.glEnd()
bgl.glPopMatrix()
bgl.glPopAttrib()
示例6: mi_draw_2d_point
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glDisable [as 别名]
def mi_draw_2d_point(point_x, point_y, p_size=4, p_col=(1.0,1.0,1.0,1.0)):
bgl.glEnable(bgl.GL_BLEND)
#bgl.glColor4f(1.0, 1.0, 1.0, 0.5)
#bgl.glLineWidth(2)
bgl.glPointSize(p_size)
# bgl.glBegin(bgl.GL_LINE_LOOP)
bgl.glBegin(bgl.GL_POINTS)
# bgl.glBegin(bgl.GL_POLYGON)
bgl.glColor4f(p_col[0], p_col[1], p_col[2], p_col[3])
bgl.glVertex2f(point_x, point_y)
bgl.glEnd()
# restore opengl defaults
bgl.glLineWidth(1)
bgl.glDisable(bgl.GL_BLEND)
bgl.glColor4f(0.0, 0.0, 0.0, 1.0)
# TODO MOVE TO UTILITIES
示例7: mi_curve_draw_3d_polyline
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glDisable [as 别名]
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)
示例8: draw_3d_polyline
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glDisable [as 别名]
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)
示例9: draw_text_2d
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glDisable [as 别名]
def draw_text_2d(self, context):
cur_stretch_settings = context.scene.mi_cur_stretch_settings
rh = context.region.height
rw = context.region.width
font_id = 0
font_size = 30
#Set font color
bgl.glEnable(bgl.GL_BLEND)
#bgl.glColor(1, 0.75, 0.1, 1)
blf.color(0, 1, 0.75, 0.1, 1)
bgl.glLineWidth(2)
#Draw text
blf.position(font_id, rw - 400, 210 - font_size, 0)
blf.size(font_id, font_size, 72)
blf.draw(font_id, str(cur_stretch_settings.points_number))
# restore opengl defaults
bgl.glLineWidth(1)
blf.color(0, 0.0, 0.0, 0.0, 1.0)
bgl.glDisable(bgl.GL_BLEND)
#bgl.glColor(0, 0.0, 0.0, 0.0, 1.0)
示例10: draw3d_polyline
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glDisable [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
示例11: draw_callback_3d
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glDisable [as 别名]
def draw_callback_3d(self, context):
"""Callback function for 3d drawing.
Args:
context:
Returns:
"""
active = context.object
selected = context.selected_objects
wm = context.window_manager
bgl.glEnable(bgl.GL_BLEND)
# joint axes
if len(selected) > 0:
if wm.draw_jointaxes:
for j in [o for o in selected if o.phobostype == 'link']:
draw_joint(j, wm.jointaxes_length)
# restore opengl defaults
bgl.glLineWidth(1)
bgl.glDisable(bgl.GL_BLEND)
bgl.glColor4f(0.0, 0.0, 0.0, 1.0)
示例12: draw_custom_3d_elements
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glDisable [as 别名]
def draw_custom_3d_elements(mode):
"""Draws custom 3D elements filled in buffers (if local view is active, then buffers are refilled also).
:param mode: drawing mode for custom 3D elements (can be: 'Normal' or 'X-ray')
:type mode: str
"""
# if empties are disabled in this viewport ... our locators and connections should be too
if not bpy.context.space_data.show_object_viewport_empty:
return
if mode == "Normal":
bgl.glEnable(bgl.GL_DEPTH_TEST)
bgl.glEnable(bgl.GL_BLEND)
bgl.glBlendFunc(bgl.GL_SRC_ALPHA, bgl.GL_ONE_MINUS_SRC_ALPHA)
# draw buffers
_primitive.draw_buffers(bpy.context.space_data)
if mode == "Normal":
bgl.glDisable(bgl.GL_DEPTH_TEST)
bgl.glDisable(bgl.GL_BLEND)
示例13: draw
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glDisable [as 别名]
def draw(self, engine, context, scene):
if self._transparent:
bgl.glEnable(bgl.GL_BLEND)
bgl.glBlendFunc(bgl.GL_ONE, bgl.GL_ONE_MINUS_SRC_ALPHA)
engine.bind_display_space_shader(scene)
bgl.glActiveTexture(bgl.GL_TEXTURE0)
bgl.glBindTexture(bgl.GL_TEXTURE_2D, self.texture_id)
bgl.glBindVertexArray(self.vertex_array[0])
bgl.glDrawArrays(bgl.GL_TRIANGLE_FAN, 0, 4)
bgl.glBindVertexArray(NULL)
bgl.glBindTexture(bgl.GL_TEXTURE_2D, NULL)
engine.unbind_display_space_shader()
err = bgl.glGetError()
if err != bgl.GL_NO_ERROR:
print("GL Error:", err)
if self._transparent:
bgl.glDisable(bgl.GL_BLEND)
示例14: glDisable
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glDisable [as 别名]
def glDisable(cap):
bgl.glDisable(cap)
示例15: draw_callback
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glDisable [as 别名]
def draw_callback(self, context):
region = context.region
if region and region == self.mouseovered_region:
bgl.glEnable(bgl.GL_BLEND)
bgl.glColor4f(1.0, 0.0, 0.0, 0.3)
bgl.glRecti(0, 0, region.width, region.height)
bgl.glDisable(bgl.GL_BLEND)
bgl.glColor4f(1.0, 1.0, 1.0, 1.0)