本文整理汇总了Python中bgl.glPointSize方法的典型用法代码示例。如果您正苦于以下问题:Python bgl.glPointSize方法的具体用法?Python bgl.glPointSize怎么用?Python bgl.glPointSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bgl
的用法示例。
在下文中一共展示了bgl.glPointSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: glSetOptions
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glPointSize [as 别名]
def glSetOptions(prefix, opts):
if not opts:
return
prefix = '%s ' % prefix if prefix else ''
def set_if_set(opt, cb):
opt = '%s%s' % (prefix, opt)
if opt in opts:
cb(opts[opt])
dpi_mult = opts.get('dpi mult', 1.0)
set_if_set('offset', lambda v: bmeshShader.assign('offset', v))
set_if_set('dotoffset', lambda v: bmeshShader.assign('dotoffset', v))
set_if_set('color', lambda v: bmeshShader.assign('color', v))
set_if_set('color selected',
lambda v: bmeshShader.assign('color_selected', v))
set_if_set('hidden', lambda v: bmeshShader.assign('hidden', v))
set_if_set('width', lambda v: bgl.glLineWidth(v*dpi_mult))
set_if_set('size', lambda v: bgl.glPointSize(v*dpi_mult))
set_if_set('stipple', lambda v: glEnableStipple(v))
示例2: mi_draw_2d_point
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glPointSize [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
示例3: mi_curve_draw_3d_polyline
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glPointSize [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_2d_point
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glPointSize [as 别名]
def 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)
示例5: draw_2d_point
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glPointSize [as 别名]
def 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)
coords = ((point_x, point_y), (point_x, point_y))
batch = batch_for_shader(shader2d, 'POINTS', {"pos": coords})
shader2d.bind()
shader2d.uniform_float("color", (p_col[0], p_col[1], p_col[2], p_col[3]))
batch.draw(shader2d)
# bgl.glBegin(bgl.GL_POINTS)
# 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)
示例6: draw_3d_points
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glPointSize [as 别名]
def draw_3d_points(context, points, color, size):
'''
draw a bunch of dots
args:
points: a list of tuples representing x,y SCREEN coordinate eg [(10,30),(11,31),...]
color: tuple (r,g,b,a)
size: integer? maybe a float
'''
points_2d = [location_3d_to_region_2d(context.region, context.space_data.region_3d, loc) for loc in points]
if None in points_2d:
points_2d = filter(None, points_2d)
bgl.glColor4f(*color)
bgl.glPointSize(size)
bgl.glBegin(bgl.GL_POINTS)
for coord in points_2d:
#TODO: Debug this problem....perhaps loc_3d is returning points off of the screen.
if coord:
bgl.glVertex2f(*coord)
bgl.glEnd()
return
示例7: draw_3d_points_revised
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glPointSize [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_circle
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glPointSize [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()
示例9: draw_opengl
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glPointSize [as 别名]
def draw_opengl(self,context):
region = self._window_region(context)
if self.placed_first_point:
help_text = "Command Help:\nLEFT CLICK: Place Second Point\nRIGHT CLICK: Cancel Command"
else:
help_text = "Command Help:\nLEFT CLICK: Place First Point\nRIGHT CLICK: Cancel Command"
if self.found_snap_point:
help_text += "\n SNAP TO VERTEX"
help_box = TextBox(
x=0,y=0,
width=500,height=0,
border=10,margin=100,
message=help_text)
help_box.x = (self.mouse_x + (help_box.width) / 2 + 10) - region.x
help_box.y = (self.mouse_y - 10) - region.y
help_box.draw()
# SNAP POINT
bgl.glPushAttrib(bgl.GL_ENABLE_BIT)
bgl.glColor4f(255, 0.0, 0.0, 1.0)
bgl.glEnable(bgl.GL_BLEND)
bgl.glPointSize(10)
bgl.glBegin(bgl.GL_POINTS)
if self.snapping_point_2d:
bgl.glVertex2f(self.snapping_point_2d[0], self.snapping_point_2d[1])
bgl.glEnd()
bgl.glPopAttrib()
# restore opengl defaults
bgl.glDisable(bgl.GL_BLEND)
bgl.glColor4f(0.0, 0.0, 0.0, 1.0)
示例10: point_size
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glPointSize [as 别名]
def point_size(self, size): bgl.glPointSize(max(1, self.scale(size)))
示例11: draw_callback_px_3d
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glPointSize [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)
示例12: draw_callback_px_2d
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glPointSize [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)
示例13: draw_3d_polyline
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glPointSize [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)
示例14: drawCallback
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glPointSize [as 别名]
def drawCallback(self):
mat = self.interfacer.getBlenderObject().matrix_world
if self.do_draw and self.interfacer.isClean():
# isClean() is not really needed here, but it shows its
# behavior and helps reducing (a tiny bit!) the run time...
bgl.glColor3f(0.0, 1.0, 1.0)
bgl.glPointSize(5)
bgl.glBegin(bgl.GL_POINTS)
for v in self.vertices:
bgl.glVertex3f(*(mat*v))
bgl.glEnd()
bgl.glPointSize(1)
bgl.glColor3f(1.0, 1.0, 0.0)
bgl.glLineWidth(2)
bgl.glBegin(bgl.GL_LINES)
for v, w in zip(self.vertices, self.velocities):
bgl.glVertex3f(*(mat*v))
bgl.glVertex3f(*(mat*(v + w)))
bgl.glEnd()
bgl.glLineWidth(1)
# this in toplevel is also requested
# MAIN_CLASS should be set to any callable returning the
# requested instance, which provides the update() method.
示例15: draw3d_points
# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glPointSize [as 别名]
def draw3d_points(points, color, size, view_loc, view_ortho, zfar=0.997):
if not points: return
bgl.glColor4f(*color)
bgl.glPointSize(size)
set_depthrange(0.0, zfar, points, view_loc, view_ortho)
bgl.glBegin(bgl.GL_POINTS)
for coord in points: bgl.glVertex3f(*coord)
bgl.glEnd()
bgl.glPointSize(1.0)
# draws polylines.