当前位置: 首页>>代码示例>>Python>>正文


Python bgl.glVertex2i方法代码示例

本文整理汇总了Python中bgl.glVertex2i方法的典型用法代码示例。如果您正苦于以下问题:Python bgl.glVertex2i方法的具体用法?Python bgl.glVertex2i怎么用?Python bgl.glVertex2i使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在bgl的用法示例。


在下文中一共展示了bgl.glVertex2i方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: draw_callback_px

# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glVertex2i [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) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:27,代码来源:operator_modal_draw.py

示例2: draw_callback_px

# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glVertex2i [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) 
开发者ID:LesFeesSpeciales,项目名称:image-background-transform,代码行数:21,代码来源:image_background_transform.py

示例3: BakeLab_DrawProgressBar

# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glVertex2i [as 别名]
def BakeLab_DrawProgressBar(y_shift,progress,text):
    bgl.glColor4f(0,0,0,1.0)
    bgl.glBegin(bgl.GL_QUADS)
    bgl.glVertex2i(19,  y_shift-1)
    bgl.glVertex2i(161, y_shift-1)
    bgl.glVertex2i(161, y_shift+31)
    bgl.glVertex2i(19,  y_shift+31)
    bgl.glEnd()
    bgl.glColor4f(0.7,0.5,0.3, 1.0)
    bgl.glBegin(bgl.GL_QUADS)
    bgl.glVertex2i(20,  y_shift)
    bgl.glVertex2i(160, y_shift)
    bgl.glVertex2i(160, y_shift+30)
    bgl.glVertex2i(20,  y_shift+30)
    bgl.glEnd()
    bgl.glColor4f(0.05,0.1,0.15, 1.0)
    bgl.glBegin(bgl.GL_QUADS)
    bgl.glVertex2i(21,  y_shift+1)
    bgl.glVertex2i(159, y_shift+1)
    bgl.glVertex2i(159, y_shift+29)
    bgl.glVertex2i(21,  y_shift+29)
    bgl.glEnd()
    bgl.glColor4f(0.7,0.5,0.3, 1.0)
    bgl.glBegin(bgl.GL_QUADS)
    x_loc = (157-23)*progress+23
    bgl.glVertex2i(23,         y_shift+3)
    bgl.glVertex2i(int(x_loc), y_shift+3)
    bgl.glVertex2i(int(x_loc), y_shift+27)
    bgl.glVertex2i(23,         y_shift+27)
    bgl.glEnd()
    blf.position(0, 170, y_shift+10, 0)
    blf.draw(0, text) 
开发者ID:Shahzod114,项目名称:Bakelab-Blender-addon,代码行数:34,代码来源:BakeLab_1_2.py

示例4: draw_callback_px

# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glVertex2i [as 别名]
def draw_callback_px(self, context):
    font_id = 0  # XXX, need to find out how best to get this.

    offset = 10
    text_height = 10
    text_length = int(len(self.mouse_text) * 7.3)
    
    if self.header_text != "":
        blf.size(font_id, 17, 72)
        text_w, text_h = blf.dimensions(font_id,self.header_text)
        blf.position(font_id, context.area.width/2 - text_w/2, context.area.height - 50, 0)
        blf.draw(font_id, self.header_text)

    # 50% alpha, 2 pixel width line
    if self.mouse_text != "":
        bgl.glEnable(bgl.GL_BLEND)
        bgl.glColor4f(0.0, 0.0, 0.0, 0.5)
        bgl.glLineWidth(10)
    
        bgl.glBegin(bgl.GL_LINE_STRIP)
        bgl.glVertex2i(self.mouse_loc[0]-offset-5, self.mouse_loc[1]+offset)
        bgl.glVertex2i(self.mouse_loc[0]+text_length-offset, self.mouse_loc[1]+offset)
        bgl.glVertex2i(self.mouse_loc[0]+text_length-offset, self.mouse_loc[1]+offset+text_height)
        bgl.glVertex2i(self.mouse_loc[0]-offset-5, self.mouse_loc[1]+offset+text_height)
        bgl.glEnd()
        
        bgl.glColor4f(1.0, 1.0, 1.0, 1.0)
        blf.position(font_id, self.mouse_loc[0]-offset, self.mouse_loc[1]+offset, 0)
        blf.size(font_id, 15, 72)
        blf.draw(font_id, self.mouse_text)
        
    # restore opengl defaults
    bgl.glLineWidth(1)
    bgl.glDisable(bgl.GL_BLEND)
    bgl.glColor4f(0.0, 0.0, 0.0, 1.0) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:37,代码来源:utils.py

示例5: draw_callback

# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glVertex2i [as 别名]
def draw_callback(self, context):
    mid = int(360 * self.recv / self.fsize)
    cx = 200
    cy = 30
    blf.position(0, 230, 23, 0)
    blf.size(0, 20, 72)
    blf.draw(0, "{0:2d}% of {1}".format(
        100 * self.recv // self.fsize, self.hfsize))

    bgl.glEnable(bgl.GL_BLEND)
    bgl.glColor4f(.7, .7, .7, 0.8)
    bgl.glBegin(bgl.GL_TRIANGLE_FAN)
    bgl.glVertex2i(cx, cy)
    for i in range(mid):
        x = cx + 20 * math.sin(math.radians(float(i)))
        y = cy + 20 * math.cos(math.radians(float(i)))
        bgl.glVertex2f(x, y)
    bgl.glEnd()

    bgl.glColor4f(.0, .0, .0, 0.6)
    bgl.glBegin(bgl.GL_TRIANGLE_FAN)
    bgl.glVertex2i(cx, cy)
    for i in range(mid, 360):
        x = cx + 20 * math.sin(math.radians(float(i)))
        y = cy + 20 * math.cos(math.radians(float(i)))
        bgl.glVertex2f(x, y)
    bgl.glEnd()

    bgl.glDisable(bgl.GL_BLEND)
    bgl.glColor4f(0.0, 0.0, 0.0, 1.0) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:32,代码来源:download.py

示例6: drawPoint

# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glVertex2i [as 别名]
def drawPoint(x, y, main=True):
        r = 6 if main else 3

        bgl.glBegin(bgl.GL_LINES)
        bgl.glColor3f(1.0, 1.0, 1.0)
        bgl.glVertex2i(x - r, y)
        bgl.glVertex2i(x - r, y + r)
        bgl.glVertex2i(x - r, y + r)
        bgl.glVertex2i(x, y + r)
        
        bgl.glVertex2i(x + r, y)
        bgl.glVertex2i(x + r, y - r)
        bgl.glVertex2i(x + r, y - r)
        bgl.glVertex2i(x, y - r)
        
        bgl.glColor3f(0.0, 0.0, 0.0)
        bgl.glVertex2i(x, y + r)
        bgl.glVertex2i(x + r, y + r)
        bgl.glVertex2i(x + r, y + r)
        bgl.glVertex2i(x + r, y)
        
        bgl.glVertex2i(x, y - r)
        bgl.glVertex2i(x - r, y - r)
        bgl.glVertex2i(x - r, y - r)
        bgl.glVertex2i(x - r, y)
        bgl.glEnd() 
开发者ID:qwenger,项目名称:BAddons,代码行数:28,代码来源:node_colorramp_dropper.py

示例7: draw_edit_mode

# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glVertex2i [as 别名]
def draw_edit_mode(self,context,color=[0.41, 0.38, 1.0, 1.0],text="Edit Shapekey Mode",offset=0):
    region = context.region
    x = region.width
    y = region.height
    
    scale = x / 1200
    scale = clamp(scale,.5,1.5)
    
    r_offset = 0
    if context.user_preferences.system.use_region_overlap:
        r_offset = context.area.regions[1].width

    ### draw box behind text
    b_width = int(240*scale)
    b_height = int(36*scale)
    
    bgl.glEnable(bgl.GL_BLEND)
    bgl.glColor4f(color[0],color[1],color[2],color[3])
    
    bgl.glBegin(bgl.GL_QUADS)
    bgl.glVertex2i(x-b_width, 0)
    bgl.glVertex2i(x, 0)
    bgl.glVertex2i(x, b_height)
    bgl.glVertex2i(x-b_width, b_height)
    bgl.glVertex2i(x-b_width, 0) 
    bgl.glEnd()
    
    ### draw edit type
    font_id = 0  # XXX, need to find out how best to get this.
    bgl.glColor4f(0.041613, 0.041613, 0.041613, 1.000000)
    text_offset = int((220+offset)*scale)
    text_y_offset = int(11 * scale)
    blf.position(font_id, x-text_offset, text_y_offset, 0)
    blf.size(font_id, 20, int(72*scale))
    blf.draw(font_id, text)
    
    ### draw viewport outline
    bgl.glEnable(bgl.GL_BLEND)
    bgl.glColor4f(color[0],color[1],color[2],color[3])
    bgl.glLineWidth(4)

    bgl.glBegin(bgl.GL_LINE_STRIP)
    bgl.glVertex2i(r_offset, 0)
    bgl.glVertex2i(r_offset+x, 0)
    bgl.glVertex2i(r_offset+x, y)
    bgl.glVertex2i(r_offset+0, y)
    bgl.glVertex2i(r_offset, 0)

    bgl.glEnd()

    # restore opengl defaults
    bgl.glLineWidth(1)
    bgl.glDisable(bgl.GL_BLEND)
    bgl.glColor4f(0.0, 0.0, 0.0, 1.0) 
开发者ID:ndee85,项目名称:coa_tools,代码行数:56,代码来源:functions_draw.py

示例8: BakeLab_DrawCallback

# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glVertex2i [as 别名]
def BakeLab_DrawCallback(self, context):
    props = context.scene.BakeLabProps
    ww = context.area.width
    wh = context.area.height
    
    bgl.glEnable(bgl.GL_BLEND)
    blf.enable(0,blf.SHADOW)
    blf.shadow(0,5,0,0.0,0.0,1)
    
    ######### Title {
    bgl.glBegin(bgl.GL_QUADS)
    bgl.glColor4f(0.88, 0.87, 0.85, 0.1)
    for i in range(0,20):
        bgl.glVertex2i(0,       wh)
        bgl.glVertex2i(120+i*3, wh)
        bgl.glVertex2i(120+i*3, wh-70)
        bgl.glVertex2i(0,       wh-70)
        
    bgl.glColor4f(0.7,0.1,0.3, 0.1)
    for i in range(0,20):
        bgl.glVertex2i(0,       wh-70)
        bgl.glVertex2i(140+i*3, wh-70)
        bgl.glVertex2i(140+i*3, wh-75)
        bgl.glVertex2i(0,       wh-75)
    bgl.glEnd()
    
    blf.size(0, 30, 72)
    bgl.glColor4f(0.7,0.1,0.3, 1.0)
    blf.position(0, 15, context.area.height-58, 0)
    blf.draw(0, 'BakeLab')
    ######### }
    
    ######### Progress {
    blf.size(0, 15, 72)
    y_shift = 15
    #######################################################################
    cur = self.bake_item_id
    max = len(context.scene.BakeLabMapColl)
    BakeLab_DrawProgressBar(y_shift,cur/max,'Map: '+ str(cur)+' of '+str(max))
    y_shift += 30
    #######################################################################
    if not props.s_to_a and not props.all_in_one:
        cur = self.bake_obj_id
        max = len(self.bake_objs)
        BakeLab_DrawProgressBar(y_shift,cur/max,'Object: '+ str(cur)+' of '+str(max))
        y_shift += 30
    #######################################################################
    if props.use_list:
        cur = self.ObjListIndex
        max = len(context.scene.BakeLabObjColl)
        BakeLab_DrawProgressBar(y_shift,cur/max,'List: '+ str(cur)+' of '+str(max))
        y_shift += 30
    #######################################################################
    ######### }
    
    
    blf.disable(0,blf.SHADOW)
    bgl.glDisable(bgl.GL_BLEND)
    bgl.glColor4f(0.0, 0.0, 0.0, 1.0) 
开发者ID:Shahzod114,项目名称:Bakelab-Blender-addon,代码行数:61,代码来源:BakeLab_1_2.py

示例9: draw_bookmark

# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glVertex2i [as 别名]
def draw_bookmark(self, context):
        r = context.region
        rv3d = context.region_data

        bookmark = self.bookmarks.get_item()
        if not bookmark:
            return

        pos = self.convert_to_abs(context.space_data, bookmark.pos)
        if pos is None:
            return

        projected = location_3d_to_region_2d(r, rv3d, pos)

        if projected:
            # Store previous OpenGL settings
            smooth_prev = gl_get(bgl.GL_SMOOTH)

            pixelsize = 1
            dpi = context.user_preferences.system.dpi
            widget_unit = (pixelsize * dpi * 20.0 + 36.0) / 72.0

            bgl.glShadeModel(bgl.GL_SMOOTH)
            bgl.glLineWidth(2)
            bgl.glColor4f(0.0, 1.0, 0.0, 1.0)
            bgl.glBegin(bgl.GL_LINE_STRIP)
            radius = widget_unit * 0.3 #6
            n = 8
            da = 2 * math.pi / n
            x, y = projected
            x, y = int(x), int(y)
            for i in range(n + 1):
                a = i * da
                dx = math.sin(a) * radius
                dy = math.cos(a) * radius
                if (i % 2) == 0:
                    bgl.glColor4f(0.0, 1.0, 0.0, 1.0)
                else:
                    bgl.glColor4f(0.0, 0.0, 0.0, 1.0)
                bgl.glVertex2i(x + int(dx), y + int(dy))
            bgl.glEnd()

            # Restore previous OpenGL settings
            gl_enable(bgl.GL_SMOOTH, smooth_prev) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:46,代码来源:space_view3d_enhanced_3d_cursor.py


注:本文中的bgl.glVertex2i方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。