本文整理汇总了Python中bgl.glVertex3f方法的典型用法代码示例。如果您正苦于以下问题:Python bgl.glVertex3f方法的具体用法?Python bgl.glVertex3f怎么用?Python bgl.glVertex3f使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bgl
的用法示例。
在下文中一共展示了bgl.glVertex3f方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: draw_offset
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glVertex3f [as 别名]
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 ===== #
示例2: draw_arrow
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glVertex3f [as 别名]
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()
示例3: mi_curve_draw_3d_polyline
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glVertex3f [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)
示例4: draw_3d_polyline
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glVertex3f [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)
示例5: draw3d_polyline
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glVertex3f [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
示例6: draw_circle
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glVertex3f [as 别名]
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)
示例7: draw_3d_points_revised
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glVertex3f [as 别名]
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()
示例8: draw_joint
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glVertex3f [as 别名]
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()
示例9: draw_circle
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glVertex3f [as 别名]
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()
示例10: draw_trace
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glVertex3f [as 别名]
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()
示例11: draw_line
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glVertex3f [as 别名]
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()
示例12: drawLine3D
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glVertex3f [as 别名]
def drawLine3D(color, start, end, width=1):
bgl.glLineWidth(width)
bgl.glColor4f(*color)
bgl.glBegin(bgl.GL_LINES)
bgl.glVertex3f(*start)
bgl.glVertex3f(*end)
示例13: draw_callback_px_3d
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glVertex3f [as 别名]
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)
示例14: draw_callback_px_2d
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glVertex3f [as 别名]
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)
示例15: draw_3d_polyline
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glVertex3f [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)
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)