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


Python gl.glVertex2f函数代码示例

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


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

示例1: draw_circle

def draw_circle(cx, cy, r, num_segments=None, mode=gl.GL_POLYGON, color=(1, 1, 1, 1)):
	if not num_segments:
		num_segments = get_num_circle_segments(r)

	theta = 2 * math.pi / float(num_segments)
	tangetial_factor = math.tan(theta)
	radial_factor = math.cos(theta)

	x = float(r)
	y = 0.0

	gl.glColor4f(color[0], color[1], color[2], color[3])
	gl.glBegin(mode)
	for i in xrange(num_segments):
		gl.glVertex2f(x + cx, y + cy)

		tx = y * -1
		ty = x

		x += tx * tangetial_factor
		y += ty * tangetial_factor

		x *= radial_factor
		y *= radial_factor
	gl.glEnd()
开发者ID:PermianLizard,项目名称:Pyweek-17,代码行数:25,代码来源:render.py

示例2: nakresli_caru

def nakresli_caru(x1, y1, x2, y2):
   
    gl.glBegin(gl.GL_LINES)
    #  gl.glBegin(gl.GL_TRIANGLE_FAN)
    gl.glVertex2f(x1, y1)
    gl.glVertex2f(x2, y2)   
    gl.glEnd()
开发者ID:zzuzzy,项目名称:PyLadies,代码行数:7,代码来源:myPong.py

示例3: draw_points

    def draw_points(self):
        self.points_lock.acquire()
        
        try:
            from pyglet.gl import glBegin, glEnd, GL_POINTS, glColor4f, glVertex2f
                   
            glBegin(GL_POINTS)
               
            for i in xrange(0, len(self.points)):
                p = self.points[i]
                parameter_index = self.parameter_indices[0]
                state_index = self.state_indices[0]

                glColor4f(1, 1, 1, p.age / (self.age_max*2.0))
                glVertex2f(p.parameters[parameter_index], p.state[state_index])
                
                p.state = self.system.iterate(p.state, p.parameters)
                p.age += 1
                
                #if p.age >= self.age_max:
                #    self.points[i] = OrbitPoint(tool=self, varying_parameter=p.parameters[parameter_index])
            
            glEnd()
        except Exception, detail:
            print 'draw_points()', type(detail), detail
开发者ID:cmorgan,项目名称:dypy,代码行数:25,代码来源:OrbitTool.py

示例4: draw_block

def draw_block(block):
    transformed = [world_to_screen(block.GetWorldPoint(p)) for p in POINTS]
    gl.glColor3f(1.0, 0.1, 0)
    gl.glBegin(gl.GL_LINE_LOOP)
    for p in transformed:
        gl.glVertex2f(*p)
    gl.glEnd()
开发者ID:ChunyangSun,项目名称:VisionAndPhysicsEngine,代码行数:7,代码来源:demo1.py

示例5: draw_points

    def draw_points(self):
        self.points_lock.acquire()

        try:
            from pyglet.gl import glCallList, glBegin, GL_LINE_STRIP, glColor4f, glVertex2f, glEnd

            # line from previous iterate to next iterate of function
            glBegin(GL_LINE_STRIP)
            glColor4f(1, 1, 1, 0.3)

            state_index = self.state_indices[0]

            for i in [1, 2]:
                state_previous = self.point.state[state_index]
                self.point.state = self.system.iterate(self.point.state, self.point.parameters)

                glVertex2f(state_previous, state_previous)
                glVertex2f(state_previous, self.point.state[state_index])

            glEnd()

            # call display lists, doesn't work in init_points()
            if self.server.iteration <= 1:
                glCallList(self.iterate_list)
                glCallList(self.reflection_list)
        except Exception, detail:
            print "draw_points()", type(detail), detail
开发者ID:cmorgan,项目名称:dypy,代码行数:27,代码来源:CobwebTool.py

示例6: draw

 def draw(self, colour=(0., 0., 1.)):
   s = self.size # just a shorthand
   gl.glColor3f(*colour)
   gl.glBegin(gl.GL_LINE_LOOP)
   for vertex in self.verticies:
     gl.glVertex2f(*vertex)
   gl.glEnd()
开发者ID:DomNomNom,项目名称:Jumpy2D,代码行数:7,代码来源:Trigger.py

示例7: draw

 def draw(self):
   r = self.size.x
   gl.glColor3f(1.0, .7, 0.0)
   with shiftView(self.body.position):
     gl.glBegin(gl.GL_LINE_LOOP)
     for angle in xrange(0, 360, 360/12):
       gl.glVertex2f(*self.size.rotated_degrees(angle))
     gl.glEnd()
开发者ID:DomNomNom,项目名称:Jumpy2D,代码行数:8,代码来源:Explosion.py

示例8: display_pointer

def display_pointer(angle, color, radius):
    x_value = math.cos(angle)
    y_value = math.sin(angle)
    glBegin(GL_LINES)
    glColor3ub(*color)
    glVertex2f(0.0, 0.0)
    glVertex2f(x_value * radius, y_value * radius)
    glEnd()
开发者ID:Matt-Esch,项目名称:anaconda,代码行数:8,代码来源:kcclock.py

示例9: 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

示例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_fan

def draw_fan(center, vertices, color):
    gl.glPushMatrix()
    gl.glColor4f(*color)
    gl.glBegin(gl.GL_TRIANGLE_FAN)
    gl.glVertex2f(center[0], center[1])
    for vertex in vertices:
        gl.glVertex2f(vertex[0], vertex[1])
    gl.glEnd()
    gl.glPopMatrix()
开发者ID:mraxilus,项目名称:color-blind,代码行数:9,代码来源:graphics.py

示例12: draw

    def draw(self):
        gl.glColor3f(1, 1, 1)
        gl.glBegin(gl.GL_LINES)
        gl.glVertex2f(0, 50)
        gl.glVertex2f(self.window.width, 50)
        gl.glEnd()

        for label in self.labels:
            label.draw()
开发者ID:DatRollingStone,项目名称:nwidget,代码行数:9,代码来源:VALIGN.py

示例13: 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

示例14: 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

示例15: circle

def circle(x, y, radius):
    iterations = int(tau * radius) * 2
    s = sin(tau / iterations)
    c = cos(tau / iterations)
    gl.glBegin(gl.GL_TRIANGLE_FAN)
    gl.glVertex2f(x, y)
    dx, dy = radius, 0
    for i in range(iterations + 1):
        gl.glVertex2f(x + dx, y + dy)
        dx, dy = (dx * c - dy * s), (dy * c + dx * s)
    gl.glEnd()
开发者ID:encukou,项目名称:slides,代码行数:11,代码来源:gitvisualizer.py


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