• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python gl.glVertex3f函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: draw_line

 def draw_line(self, v, color):
     o = self._p._origin
     pgl.glBegin(pgl.GL_LINES)
     pgl.glColor3f(*color)
     pgl.glVertex3f(v[0][0] + o[0], v[0][1] + o[1], v[0][2] + o[2])
     pgl.glVertex3f(v[1][0] + o[0], v[1][1] + o[1], v[1][2] + o[2])
     pgl.glEnd()
开发者ID:bjodah,项目名称:sympy,代码行数:7,代码来源:plot_axes.py


示例2: draw

    def draw(self, scale, pos):
        LINE_COLOUR = (255, 255, 255)

        # gl.glEnable(gl.GL_DEPTH_TEST);
        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_DONT_CARE)

        gl.glBegin(gl.GL_LINES)
        for link in self.links:
            if link.highlight:
                gl.glColor3ub(*self.colour)
                gl.glColor3ub(*self.colour)
            else:
                gl.glColor3ub(*LINE_COLOUR)
                gl.glColor3ub(*LINE_COLOUR)
            if link.highlight:
                depth = 0.5
            else:
                depth = 0.5
            gl.glVertex3f(*util.add_tup(pos, util.scale_tup(link.points[0].pos, scale)) + (depth,))
            gl.glVertex3f(*util.add_tup(pos, util.scale_tup(link.points[1].pos, scale)) + (depth,))
            print util.add_tup(pos, util.scale_tup(link.points[0].pos, scale))
        gl.glEnd()
开发者ID:Hugoagogo,项目名称:squiglet,代码行数:25,代码来源:__init__.py


示例3: f

 def f():
     for u in range(1, len(self.u_set)):
         pgl.glBegin(pgl.GL_QUAD_STRIP)
         for v in range(len(self.v_set)):
             pa = self.verts[u - 1][v]
             pb = self.verts[u][v]
             if pa is None or pb is None:
                 pgl.glEnd()
                 pgl.glBegin(pgl.GL_QUAD_STRIP)
                 continue
             if use_cverts:
                 ca = self.cverts[u - 1][v]
                 cb = self.cverts[u][v]
                 if ca is None:
                     ca = (0, 0, 0)
                 if cb is None:
                     cb = (0, 0, 0)
             else:
                 if use_solid_color:
                     ca = cb = self.default_solid_color
                 else:
                     ca = cb = self.default_wireframe_color
             pgl.glColor3f(*ca)
             pgl.glVertex3f(*pa)
             pgl.glColor3f(*cb)
             pgl.glVertex3f(*pb)
         pgl.glEnd()
开发者ID:bjodah,项目名称:sympy,代码行数:27,代码来源:plot_surface.py


示例4: render1

 def render1(self):
     if   len(self.v) == 4 : gl.glBegin(gl.GL_QUADS)
     elif len(self.v)  > 4 : gl.glBegin(gl.GL_POLYGON)
     else: gl.glBegin(gl.GL_TRIANGLES)
     for p in self.v:
         gl.glVertex3f(p[0], p[1],0)  # draw each vertex
     gl.glEnd()
开发者ID:PangYanbo,项目名称:gym-extensions,代码行数:7,代码来源:gym_rendering.py


示例5: bounce

def bounce(thing, other, vector=None):
    screen = thing.screen

    velocity_perpendicular = thing.vel.proj(vector)
    velocity_parallel = thing.vel - velocity_perpendicular

    if vector * thing.vel > 0:
        thing.vel = (
            screen.constants["friction"] * velocity_parallel + screen.constants["elasticity"] * velocity_perpendicular
        )
    else:
        thing.vel = (
            screen.constants["friction"] * velocity_parallel - screen.constants["elasticity"] * velocity_perpendicular
        )

    thing.position_component.position += screen.constants["displace"] * vector

    if other.immobile:
        thing.position_component.position += vector

    if screen.draw_debug:
        opengl.glBegin(opengl.GL_LINES)
        p = thing.position_component.position
        opengl.glVertex3f(p.x, p.y, 11)
        opengl.glVertex3f(p.x + 5 * vector.x, p.y + 5 * vector.y, 11)
        opengl.glEnd()
开发者ID:shoofle,项目名称:mindjailengine,代码行数:26,代码来源:phys_comp.py


示例6: draw_arrow

                def draw_arrow(p1, p2):
                    """
                    Draw a single vector.
                    """
                    glColor3f(0.4, 0.4, 0.9)
                    glVertex3f(*p1)

                    glColor3f(0.9, 0.4, 0.4)
                    glVertex3f(*p2)
开发者ID:archipleago-creature,项目名称:sympy,代码行数:9,代码来源:pyglet_plotting.py


示例7: renderCatalog

	def renderCatalog(cat, far):
		gl.glDisable(gl.GL_LIGHTING)
		for s in cat:
			c = s.getRgb()
			gl.glPointSize(s.getSize())
			gl.glBegin(gl.GL_POINTS)
			gl.glColor3f(c[0], c[1], c[2])
			gl.glVertex3f(far * cos(s.ra_rad) * cos(s.dec_rad), far * sin(s.ra_rad) * cos(s.dec_rad), far * sin(s.dec_rad))
			gl.glEnd()
		gl.glEnable(gl.GL_LIGHTING)
开发者ID:Tythos,项目名称:hypyr,代码行数:10,代码来源:stellar.py


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


示例9: draw_canvas

def draw_canvas():
    # Draw full-screen canvas
    gl.glDrawBuffer(gl.GL_COLOR_ATTACHMENT0_EXT)
    gl.glBegin(gl.GL_QUADS)
    for coords in [(-1.0, -1.0),
                   (1.0, -1.0),
                   (1.0, 1.0),
                   (-1.0,  1.0)]:
        gl.glVertex3f(coords[0], coords[1], 0.0)

    gl.glEnd()
开发者ID:certik,项目名称:scikits.gpu,代码行数:11,代码来源:shader_offscreen.py


示例10: draw_callback

 def draw_callback(self, nx, ny, z):
     gl.glLineWidth(self.BOLT_WIDTH)
     gl.glBegin(gl.GL_LINES)
     gl.glColor4f(self.COLOR[0], self.COLOR[1], self.COLOR[2], 1)
     gl.glVertex3f(self.x, self.y, z)
     gl.glColor4f(self.COLOR[0] * 0.7, self.COLOR[1] * 0.7,
                  self.COLOR[2] * 0.7, 0)
     gl.glVertex3f(self.x + nx * self.BOLT_LENGTH,
                   self.y + ny * self.BOLT_LENGTH, z)
     gl.glColor3f(1, 1, 1)
     gl.glEnd()
开发者ID:noonat,项目名称:deathbeam,代码行数:11,代码来源:particles.py


示例11: draw

    def draw(self):
        glPushMatrix()

        glBegin(GL_LINES)
        glColor4f(*self.color)
        for di in [-1, 1]:
            for dj in [-1, 1]:
                glVertex3f(0, 0, 0)
                glVertex3f(self.scale * di, self.scale * dj, self.height)
        glEnd()

        glPopMatrix()
开发者ID:MakotoEZURE,项目名称:Printrun,代码行数:12,代码来源:actors.py


示例12: draw

    def draw(self):
        p = adjust_for_cam(self._body.position)

        gl.glEnable(pyglet.gl.GL_TEXTURE_2D)
        gl.glBindTexture(gl.GL_TEXTURE_2D, BLASTER_IMAGE.id)
        gl.glEnable(gl.GL_POINT_SPRITE)
        gl.glTexEnvi(gl.GL_POINT_SPRITE, gl.GL_COORD_REPLACE, gl.GL_TRUE)
        gl.glPointSize(4 * SPACE.scale)

        gl.glBegin(gl.GL_POINTS)
        # TODO: more optimized to draw as one large batch
        gl.glVertex3f(p.x, p.y, 0)
        gl.glEnd();
开发者ID:mappy13,项目名称:nihil-ace,代码行数:13,代码来源:projectiles.py


示例13: draw_line

def draw_line(start_x, start_y, end_x, end_y, color, border_width=1):

    """
    Draw a line.

    Args:
        :start_x: x position of line starting point.
        :start_y: y position of line starting point.
        :end_x: x position of line ending point.
        :end_y: y position of line ending point.
        :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()
    >>> arcade.draw_line(270, 495, 300, 450, arcade.color.WOOD_BROWN, 3)
    >>> color = (127, 0, 127, 127)
    >>> arcade.draw_line(280, 495, 320, 450, color, 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)
    GL.glVertex3f(start_x, start_y, 0.5)
    GL.glVertex3f(end_x, end_y, 0.5)
    GL.glEnd()
开发者ID:sions,项目名称:arcade,代码行数:51,代码来源:draw_commands.py


示例14: draw_polygon_outline

def draw_polygon_outline(point_list, color, border_width=1):
    """
    Draw a polygon outline. Also known as a "line loop."

    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

    >>> import arcade
    >>> arcade.open_window("Drawing Example", 800, 600)
    >>> arcade.set_background_color(arcade.color.WHITE)
    >>> arcade.start_render()
    >>> point_list = ((30, 240), \
(45, 240), \
(60, 255), \
(60, 285), \
(45, 300), \
(30, 300))
    >>> arcade.draw_polygon_outline(point_list, arcade.color.SPANISH_VIOLET, 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)

    # Set line width
    GL.glLineWidth(border_width)

    GL.glLoadIdentity()

    # 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)
    for point in point_list:
        GL.glVertex3f(point[0], point[1], 0.5)
    GL.glEnd()
开发者ID:sions,项目名称:arcade,代码行数:50,代码来源:draw_commands.py


示例15: render_indicators

 def render_indicators(self, W, H):
     gl.glBegin(gl.GL_QUADS)
     s = W/40.0
     h = H/40.0
     gl.glColor4f(0,0,0,1)
     gl.glVertex3f(W, 0, 0)
     gl.glVertex3f(W, 5*h, 0)
     gl.glVertex3f(0, 5*h, 0)
     gl.glVertex3f(0, 0, 0)
     def vertical_ind(place, val, color):
         gl.glColor4f(color[0], color[1], color[2], 1)
         gl.glVertex3f((place+0)*s, h + h*val, 0)
         gl.glVertex3f((place+1)*s, h + h*val, 0)
         gl.glVertex3f((place+1)*s, h, 0)
         gl.glVertex3f((place+0)*s, h, 0)
     def horiz_ind(place, val, color):
         gl.glColor4f(color[0], color[1], color[2], 1)
         gl.glVertex3f((place+0)*s, 4*h , 0)
         gl.glVertex3f((place+val)*s, 4*h, 0)
         gl.glVertex3f((place+val)*s, 2*h, 0)
         gl.glVertex3f((place+0)*s, 2*h, 0)
     true_speed = np.sqrt(np.square(self.car.hull.linearVelocity[0]) + np.square(self.car.hull.linearVelocity[1]))
     vertical_ind(5, 0.02*true_speed, (1,1,1))
     vertical_ind(7, 0.01*self.car.wheels[0].omega, (0.0,0,1)) # ABS sensors
     vertical_ind(8, 0.01*self.car.wheels[1].omega, (0.0,0,1))
     vertical_ind(9, 0.01*self.car.wheels[2].omega, (0.2,0,1))
     vertical_ind(10,0.01*self.car.wheels[3].omega, (0.2,0,1))
     horiz_ind(20, -10.0*self.car.wheels[0].joint.angle, (0,1,0))
     horiz_ind(30, -0.8*self.car.hull.angularVelocity, (1,0,0))
     gl.glEnd()
     self.score_label.text = "%04i" % self.reward
     self.score_label.draw()
开发者ID:jiapei100,项目名称:gym,代码行数:32,代码来源:car_racing.py


示例16: run

 def run(self):
     while not self.has_exit:
         dt = pyglet.clock.tick()
         self.dispatch_events()
         gl.glClear(gl.GL_COLOR_BUFFER_BIT)
         gl.glLoadIdentity()
         self.shader.use()
         self.shader["real"] = self.real
         self.shader["w"] = self.w
         self.shader["imag"] = self.imag
         self.shader["h"] = self.h
         gl.glBegin(gl.GL_QUADS)
         gl.glVertex3f(0.0, 0.0, 0.0)
         gl.glVertex3f(0.0, self.height, 0.0)
         gl.glVertex3f(self.width, self.height, 0.0)
         gl.glVertex3f(self.width, 0.0, 0.0)
         gl.glEnd()
         self.shader.stop()
         if self.show_fps:
             self.fps.draw()
         if self.auto_zoom_in:
             self.zoom_in(dt)
         if self.auto_zoom_out:
             self.zoom_out(dt)
         self.key_move(dt=dt)
         self.flip()
开发者ID:jackha,项目名称:mandel,代码行数:26,代码来源:mandel_gl.py


示例17: rect

def rect(a, b, color=(1.0,1.0,1.0), alpha=1.0):
    """
    Draws a rectangle in the plane spanned by a,b with GL_QUADS

    :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 aa: Anti aliasing Flag

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

    """

    glDisable(GL_TEXTURE_2D)

    glBegin(GL_QUADS)
    glVertex3f(a[0], a[1], 0)
    glVertex3f(b[0], a[1], 0)
    glVertex3f(b[0], b[1], 0)
    glVertex3f(a[0], b[1], 0)

    glEnd()
    glEnable(GL_TEXTURE_2D)
    glColor4f(color+(alpha,))
开发者ID:xoryouyou,项目名称:NetArgos,代码行数:30,代码来源:glutil.py


示例18: draw

    def draw(self):
        glPushMatrix()

        glTranslatef(self.xoffset, self.yoffset, self.zoffset)

        def color(i):
            if i % self.graduations_major == 0:
                glColor4f(*self.color_grads_major)
            elif i % (self.graduations_major / 2) == 0:
                glColor4f(*self.color_grads_interm)
            else:
                if self.light: return False
                glColor4f(*self.color_grads_minor)
            return True

        # draw the grid
        glBegin(GL_LINES)
        for i in range(0, int(math.ceil(self.width + 1))):
            if color(i):
                glVertex3f(float(i), 0.0, 0.0)
                glVertex3f(float(i), self.depth, 0.0)

        for i in range(0, int(math.ceil(self.depth + 1))):
            if color(i):
                glVertex3f(0, float(i), 0.0)
                glVertex3f(self.width, float(i), 0.0)
        glEnd()

        # draw fill
        glColor4f(*self.color_fill)
        glRectf(0.0, 0.0, float(self.width), float(self.depth))

        glPopMatrix()
开发者ID:Metamaquina,项目名称:Printrun,代码行数:33,代码来源:actors.py


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


示例20: f

 def f():
     pgl.glBegin(pgl.GL_LINE_STRIP)
     for t in range(len(self.t_set)):
         p = self.verts[t]
         if p is None:
             pgl.glEnd()
             pgl.glBegin(pgl.GL_LINE_STRIP)
             continue
         if use_cverts:
             c = self.cverts[t]
             if c is None:
                 c = (0, 0, 0)
             pgl.glColor3f(*c)
         else:
             pgl.glColor3f(*self.default_wireframe_color)
         pgl.glVertex3f(*p)
     pgl.glEnd()
开发者ID:bjodah,项目名称:sympy,代码行数:17,代码来源:plot_curve.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python gl.glViewport函数代码示例发布时间:2022-05-25
下一篇:
Python gl.glVertex2f函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap