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


Python gl.glLineWidth函数代码示例

本文整理汇总了Python中pyglet.gl.glLineWidth函数的典型用法代码示例。如果您正苦于以下问题:Python glLineWidth函数的具体用法?Python glLineWidth怎么用?Python glLineWidth使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: line

def line(a, b, color=(1.0,1.0,1.0), width=1, aa=False, alpha=1.0):
    """
    Draws a line from point *a* to point *b* using GL_LINE_STRIP optionaly with GL_LINE_SMOOTH when *aa=True*

    :param a: Point a
    :type a: 2-float tuple

    :param b: Point b
    :type b: 2-float tuple

    :param color: the color in [0..1] range
    :type color: 3-float tuple

    :param width: The with for glLineWidth()

    :param aa: Anti aliasing Flag

    :param alpha: the alpha value in [0..1] range

    """

    glLineWidth(width)
    if aa:
        glEnable(GL_LINE_SMOOTH)

    draw(2,GL_LINES,('v2f',(a[0],a[1],b[0],b[1]) ) )
开发者ID:xoryouyou,项目名称:NetArgos,代码行数:26,代码来源:pool.py

示例2: on_draw

    def on_draw(self):
        self.parent.set_caption(str(pyglet.clock.get_fps()))
        gl.glClear(gl.GL_COLOR_BUFFER_BIT)
        gl.glColor4ub(*[255,255,255,255])
        self.room.bg.blit(0,0)

        self.room.render()
        
        gl.glColor4ub(255,255,255,255)
        self.player.draw()
        self.room.lightbatch.draw()
        self.player.draw_eye()
        self.player.draw_integrity()
        
        if self.pause:
            gl.glColor4ub(50,50,50,150)
            left = self.message['text'].x-self.message['text'].width/2 -5
            down = self.message['text'].y-self.message['text'].height/2 -5
            right = self.message['text'].x+self.message['text'].width/2 + 5
            up = self.message['text'].y+self.message['text'].height/2 + 5
            gl.glRecti(left,down,right,up)
            gl.glLineWidth(2)
            gl.glColor4ub(200,200,200,200)
            gl.glBegin(gl.GL_LINE_LOOP)
            gl.glVertex2i(left,down)
            gl.glVertex2i(left,up)
            gl.glVertex2i(right,up)
            gl.glVertex2i(right,down)
            gl.glEnd()
            gl.glLineWidth(1)
            gl.glColor4ub(255,255,255,255)
            self.message['text'].draw()
            self.message['helper'].draw()
            self.message['sprite'].draw()
开发者ID:Hugoagogo,项目名称:Alison-in-Wonderland,代码行数:34,代码来源:main.py

示例3: draw_canvas

    def draw_canvas(self, canvas):
        sprites, batch = canvas.get_sprites(self.scale)
        batch.draw()

        if self.highlighted_cell and self.draw_borders:
            h_x, h_y = self.highlighted_cell

            gl.glLineWidth(2.0)

            pyglet.graphics.draw(8, gl.GL_LINES,
                ("v2i", (h_x*self.scale*self.tile_size[0],
                         h_y*self.scale*self.tile_size[1],

                         h_x*self.scale*self.tile_size[0],
                         (h_y+1)*self.scale*self.tile_size[1],

                         h_x*self.scale*self.tile_size[0],
                         (h_y+1)*self.scale*self.tile_size[1],

                         (h_x+1)*self.scale*self.tile_size[0],
                         (h_y+1)*self.scale*self.tile_size[1],

                         (h_x+1)*self.scale*self.tile_size[0],
                         (h_y+1)*self.scale*self.tile_size[1],

                         (h_x+1)*self.scale*self.tile_size[0],
                         h_y*self.scale*self.tile_size[1],

                         (h_x+1)*self.scale*self.tile_size[0],
                         h_y*self.scale*self.tile_size[1],

                         h_x*self.scale*self.tile_size[0],
                         h_y*self.scale*self.tile_size[1],)),
                ("c3B", (0,0,0,255,255,255)*4))
开发者ID:spirulence,项目名称:pixelslammer,代码行数:34,代码来源:view.py

示例4: draw_message

 def draw_message(self):
     if event.message != self.current_message:
         self.current_message = event.message
         self.message_label.text = event.message
         self.message_label.font_size = event.message_size
     xa = self.message_label.content_width // 2 + 20
     ya = self.message_label.content_height // 2 + 5
     gl.glLineWidth(3.0)
     gl.glPointSize(1.0)
     draw.set_color(0, 0, 0, 0.8)
     draw.rect(
         self.message_label.x - xa, self.message_label.y - ya, self.message_label.x + xa, self.message_label.y + ya
     )
     draw.set_color(0, 0, 0, 1)
     draw.rect_outline(
         self.message_label.x - xa, self.message_label.y - ya, self.message_label.x + xa, self.message_label.y + ya
     )
     draw.points(
         (
             self.message_label.x - xa,
             self.message_label.y - ya,
             self.message_label.x + xa,
             self.message_label.y - ya,
             self.message_label.x + xa,
             self.message_label.y + ya,
             self.message_label.x - xa,
             self.message_label.y + ya,
         )
     )
     self.message_label.draw()
开发者ID:irskep,项目名称:Gluball,代码行数:30,代码来源:gluballplayer.py

示例5: set_state

 def set_state(self):
     gl.glPushAttrib(gl.GL_LINE_BIT | gl.GL_CURRENT_BIT)
     gl.glLineWidth(2)
     if self.facet.is_border_facet:
         colour = self.BORDER_FACET_COLOUR
     else:
         colour = self.INNER_FACET_COLOUR
     gl.glColor4f(*colour)
开发者ID:weltenwort,项目名称:uni_mt,代码行数:8,代码来源:facets.py

示例6: display

 def display(self, mode_2d=False):
     glEnable(GL_LINE_SMOOTH)
     orig_linewidth = (GLfloat)()
     glGetFloatv(GL_LINE_WIDTH, orig_linewidth)
     glLineWidth(3.0)
     glCallList(self.display_list)
     glLineWidth(orig_linewidth)
     glDisable(GL_LINE_SMOOTH)
开发者ID:MakotoEZURE,项目名称:Printrun,代码行数:8,代码来源:actors.py

示例7: __init__

	def __init__(self, window):
		""" Initialize the gamescreen. window is the parent window. """
		self.window = window
		self.width = window.width
		self.height= window.height
		self.draw_debug = False

		self.killcount = 0
		self.total_time = 0
		self.constants = {'drag':10, 'gravity':v(0,-30000), 'elasticity':0.7, 'friction':0.9, 'displace':0.7}

		opengl.glEnable(opengl.GL_BLEND)
		opengl.glBlendFunc(opengl.GL_SRC_ALPHA,opengl.GL_ONE)
		opengl.glLineWidth(2.0)

#		opengl.glEnable(opengl.GL_POINT_SMOOTH)
#		opengl.glHint(opengl.GL_POINT_SMOOTH_HINT,opengl.GL_NICEST)
#		opengl.glEnable(opengl.GL_LINE_SMOOTH)
#		opengl.glHint(opengl.GL_LINE_SMOOTH_HINT,opengl.GL_NICEST)
#		opengl.glEnable(opengl.GL_POLYGON_SMOOTH)
#		opengl.glHint(opengl.GL_POLYGON_SMOOTH_HINT,opengl.GL_NICEST)
		
		#Activate the depth buffer.
		opengl.glEnable(opengl.GL_DEPTH_TEST)

		#Lighting!
		#opengl.glEnable(opengl.GL_LIGHTING)
		#opengl.glEnable(opengl.GL_LIGHT0)
		#opengl.glLightf(opengl.GL_LIGHT0, opengl.GL_LINEAR_ATTENUATION, 0.05)

		###########
		# Now, since this screen represents gameplay, we're going to initialize all the elements of the game we're playing.
		# For now, this is just a pile of stuff.
		###########
		
		# Set up all the different lists of objects in the world. These roughly correspond to managers! Sort of.
		
		self.entities = []
		
		self.physics_objects = []

		self.collision_objects = []
		self.nonstatic_objects = []
		self.coltree = collision_structures.SpatialGrid()

		self.draw_objects = []
		self.draw_priority = []
		self.draw_tree = collision_structures.SpatialGrid()
		self.draw_tree.camera_rect = CollisionComponent(owner=None, pos=v(0,0), shape=shapes.Rectangle(-1,1,-1,1))
		
		self.listeners = []


		label = text.Label( 'THIS IS A TEST', 'Arial', 24, color = (0, 0, 0, 200), 
				x = self.window.width/2, y = self.window.height/4, anchor_x="center", anchor_y="center", 
				width=3*self.window.width/4, height=3*self.window.height/4, multiline=1)
		self.draw_objects.append(label)
		self.draw_priority.append(label)
开发者ID:shoofle,项目名称:mindjailengine,代码行数:58,代码来源:select_level.py

示例8: draw_line

def draw_line(a, b, color):
    gl.glPushMatrix()
    gl.glColor3f(color[0], color[1], color[2])
    gl.glLineWidth(2)
    gl.glBegin(gl.GL_LINES)
    gl.glVertex2f(a[0], a[1])
    gl.glVertex2f(b[0], b[1])
    gl.glEnd()
    gl.glPopMatrix()
开发者ID:mraxilus,项目名称:color-blind,代码行数:9,代码来源:graphics.py

示例9: draw

def draw():
    global main_batch
    gl.glClearColor(0.2, 0.4, 0.5, 1.0)
    gl.glBlendFunc (gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA)                             
    gl.glEnable (gl.GL_BLEND)                                                            
    gl.glEnable (gl.GL_LINE_SMOOTH);                                                     
    gl.glLineWidth (3)

    main_batch.draw()
开发者ID:Permafacture,项目名称:data-oriented-pyglet,代码行数:9,代码来源:first.py

示例10: line

def line(x, y, size, angle, color=(1, 0, 0, 1), thickness=1):
    x1, y1 = x, y
    x2, y2 = x1 + cos(angle) * size, y1 + sin(angle) * size
    glColor4f(*color)
    glLineWidth(thickness)
    glBegin(GL_LINES)
    glVertex2f(x1, y1)
    glVertex2f(x2, y2)
    glEnd()
开发者ID:evuez,项目名称:raycaster,代码行数:9,代码来源:geometry.py

示例11: draw_rectangle_outline

def draw_rectangle_outline(center_x, center_y, width, height, color,
                           border_width=1, tilt_angle=0):
    """
    Draw a rectangle outline.

    Args:
        :x: x coordinate of top left rectangle point.
        :y: y coordinate of top left rectangle point.
        :width: width of the rectangle.
        :height: height of the rectangle.
        :color: color, specified in a list of 3 or 4 bytes in RGB or
         RGBA format.
        :border_width: width of the lines, in pixels.
        :angle: rotation of the rectangle. Defaults to zero.
    Returns:
        None
    Raises:
        None

    Example:

    >>> import arcade
    >>> arcade.open_window("Drawing Example", 800, 600)
    >>> arcade.set_background_color(arcade.color.WHITE)
    >>> arcade.start_render()
    >>> arcade.draw_rectangle_outline(278, 150, 45, 105, \
arcade.color.BRITISH_RACING_GREEN, 2)
    >>> arcade.finish_render()
    >>> arcade.quick_run(0.25)
    """

    GL.glEnable(GL.GL_BLEND)
    GL.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA)
    GL.glEnable(GL.GL_LINE_SMOOTH)
    GL.glHint(GL.GL_LINE_SMOOTH_HINT, GL.GL_NICEST)
    GL.glHint(GL.GL_POLYGON_SMOOTH_HINT, GL.GL_NICEST)

    GL.glLoadIdentity()
    GL.glTranslatef(center_x, center_y, 0)
    if tilt_angle:
        GL.glRotatef(tilt_angle, 0, 0, 1)

    # Set line width
    GL.glLineWidth(border_width)

    # Set color
    if len(color) == 4:
        GL.glColor4ub(color[0], color[1], color[2], color[3])
    elif len(color) == 3:
        GL.glColor4ub(color[0], color[1], color[2], 255)

    GL.glBegin(GL.GL_LINE_LOOP)
    GL.glVertex3f(-width // 2, -height // 2, 0.5)
    GL.glVertex3f(width // 2, -height // 2, 0.5)
    GL.glVertex3f(width // 2, height // 2, 0.5)
    GL.glVertex3f(-width // 2, height // 2, 0.5)
    GL.glEnd()
开发者ID:sions,项目名称:arcade,代码行数:57,代码来源:draw_commands.py

示例12: __init__

	def __init__(self, window, file_name):
		""" Initialize the gamescreen. window is the parent window. """
		self.window = window
		self.width = window.width
		self.height= window.height
		self.draw_debug = False

		self.killcount = 0
		self.total_time = 0
		self.camera_rect = components.Collider(owner=None, shape=components.shapes.Rectangle(-1,1,-1,1))
		self.constants = {'drag':10, 'gravity':v(0,-30000), 'elasticity':0.7, 'friction':0.9, 'displace':0.7}

		opengl.glEnable(opengl.GL_BLEND)
		opengl.glBlendFunc(opengl.GL_SRC_ALPHA, opengl.GL_ONE)
		opengl.glLineWidth(2.0)

#		opengl.glEnable(opengl.GL_POINT_SMOOTH)
#		opengl.glHint(opengl.GL_POINT_SMOOTH_HINT,opengl.GL_NICEST)
#		opengl.glEnable(opengl.GL_LINE_SMOOTH)
#		opengl.glHint(opengl.GL_LINE_SMOOTH_HINT,opengl.GL_NICEST)
#		opengl.glEnable(opengl.GL_POLYGON_SMOOTH)
#		opengl.glHint(opengl.GL_POLYGON_SMOOTH_HINT,opengl.GL_NICEST)
		
		#Activate the depth buffer.
		opengl.glEnable(opengl.GL_DEPTH_TEST)

		###########
		# Now, since this screen represents gameplay, we're going to initialize all the elements of the game we're playing.
		# For now, this is just a pile of stuff.
		###########
		
		# Set up all the different lists of objects in the world. These roughly correspond to managers! Sort of.
		self.entities = []
		
		self.physics_objects = []

		self.collision_objects = []
		self.nonstatic_objects = []
		self.coltree = collision_structures.SpatialGrid()

		self.draw_objects = []
		self.draw_priority = []
		self.draw_tree = collision_structures.SpatialGrid()
		self.draw_tree.camera_rect = self.camera_rect
		
		self.listeners = []

		try:
			import importlib
			level_data = importlib.import_module("levels." + file_name)

			for item in level_data.generate(self):
				self.add_entity(item)
		except ImportError as e:
			print("Error loading the level " + file_name)
			raise e
开发者ID:shoofle,项目名称:mindjailengine,代码行数:56,代码来源:level_from_file.py

示例13: draw

 def draw(self):
     if not self.visible:
         return
     gl.glLineWidth(2)  # deprecated
     gl.glColor3ub(*self.color3)
     gl.glBegin(gl.GL_LINE_STRIP)
     for v in self.vertexes:
         gl.glVertex2f(*v)
     gl.glVertex2f(*self.vertexes[0])
     gl.glEnd()
开发者ID:1414648814,项目名称:cocos,代码行数:10,代码来源:mouse_elastic_box_selection.py

示例14: draw_bone

    def draw_bone(self, bone):
        p1 = bone.get_start()
        p2 = bone.get_end()

        gl.glColor4ub(*self.color)
        gl.glLineWidth(5)
        gl.glBegin(gl.GL_LINES)
        gl.glVertex2f(*p1)
        gl.glVertex2f(*p2)
        gl.glEnd()
开发者ID:fpietka,项目名称:cocos,代码行数:10,代码来源:skeleton.py

示例15: draw_lines

def draw_lines(point_list, color, border_width=1):
    """
    Draw a set of lines.

    Draw a line between each pair of points specified.

    Args:
        :point_list: List of points making up the lines. Each point is
         in a list. So it is a list of lists.
        :color: color, specified in a list of 3 or 4 bytes in RGB or
         RGBA format.
        :border_width: Width of the line in pixels.
    Returns:
        None
    Raises:
        None

    Example:

    >>> import arcade
    >>> arcade.open_window("Drawing Example", 800, 600)
    >>> arcade.set_background_color(arcade.color.WHITE)
    >>> arcade.start_render()
    >>> point_list = ((390, 450), \
(450, 450), \
(390, 480), \
(450, 480), \
(390, 510), \
(450, 510))
    >>> arcade.draw_lines(point_list, arcade.color.BLUE, 3)
    >>> arcade.finish_render()
    >>> arcade.quick_run(0.25)
    """
    GL.glEnable(GL.GL_BLEND)
    GL.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA)
    GL.glEnable(GL.GL_LINE_SMOOTH)
    GL.glHint(GL.GL_LINE_SMOOTH_HINT, GL.GL_NICEST)
    GL.glHint(GL.GL_POLYGON_SMOOTH_HINT, GL.GL_NICEST)

    GL.glLoadIdentity()

    # Set line width
    GL.glLineWidth(border_width)

    # Set color
    if len(color) == 4:
        GL.glColor4ub(color[0], color[1], color[2], color[3])
    elif len(color) == 3:
        GL.glColor4ub(color[0], color[1], color[2], 255)

    GL.glBegin(GL.GL_LINES)
    for point in point_list:
        GL.glVertex3f(point[0], point[1], 0.5)
    GL.glEnd()
开发者ID:sions,项目名称:arcade,代码行数:54,代码来源:draw_commands.py


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