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

Python gl.glEnableClientState函数代码示例

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

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



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

示例1: draw

 def draw(self, transformation, **kwargs):
     transformation.scale(self.width, self.height, 1)
     color = self.color + (self.opacity,)
     gl.glColor4fv((gl.GLfloat * 4)(*color))
     gl.glEnableClientState(gl.GL_VERTEX_ARRAY)
     gl.glVertexPointer(2, gl.GL_FLOAT, 0, self.vertices)
     gl.glDrawArrays(gl.GL_TRIANGLE_STRIP, 0, 4)
开发者ID:encukou,项目名称:gillcup_graphics,代码行数:7,代码来源:objects.py


示例2: on_draw

 def on_draw(self):
     gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT)
     gl.glMatrixMode(gl.GL_MODELVIEW)
     gl.glEnableClientState(gl.GL_VERTEX_ARRAY)
     if self.app.show_fps:
         self.fps_display.draw()
     self.app.on_draw()
开发者ID:pauleveritt,项目名称:asteroids,代码行数:7,代码来源:arcadeng.py


示例3: _draw_rects

def _draw_rects(shape_list, vertex_vbo_id, texture_coord_vbo_id):
    """
    Draw a set of rectangles using vertex buffers. This is more efficient
    than drawing them individually.
    """
    GL.glEnable(GL.GL_BLEND)
    GL.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA)
    GL.glEnable(GL.GL_TEXTURE_2D)
    GL.glHint(GL.GL_POLYGON_SMOOTH_HINT, GL.GL_NICEST)
    GL.glHint(GL.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST)

    # GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT)
    # GL.glMatrixMode(GL.GL_MODELVIEW)
    # GL.glDisable(GL.GL_BLEND)

    GL.glBindBuffer(GL.GL_ARRAY_BUFFER, vertex_vbo_id)
    GL.glEnableClientState(GL.GL_TEXTURE_COORD_ARRAY)
    GL.glEnableClientState(GL.GL_VERTEX_ARRAY)
    GL.glVertexPointer(2, GL.GL_FLOAT, 0, 0)

    GL.glBindBuffer(GL.GL_ARRAY_BUFFER, texture_coord_vbo_id)

    offset = 0
    for shape in shape_list:
        if shape.can_cache:
            texture_coord_vbo_id = None

            GL.glColor4f(1, 1, 1, shape.alpha)

            _render_rect_filled(shape, offset,
                                shape.texture.texture_id, texture_coord_vbo_id)

            offset += 4
        else:
            shape.draw()
开发者ID:pauleveritt,项目名称:arcade,代码行数:35,代码来源:sprite.py


示例4: on_draw

    def on_draw(self):
        """
        Render the screen.
        """
        start = time.time()

        float_size = ctypes.sizeof(ctypes.c_float)
        record_len = 10 * float_size

        GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT)

        GL.glMatrixMode(GL.GL_MODELVIEW)
        GL.glEnableClientState(GL.GL_VERTEX_ARRAY)

        GL.glColor4ub(255, 0, 0, 255)

        GL.glBindBuffer(GL.GL_ARRAY_BUFFER, self.rect_vbo.vbo_id)
        GL.glVertexPointer(2, GL.GL_FLOAT, record_len, 0)

        for i in range(len(self.shape_list)):
            shape = self.shape_list[i]
            GL.glLoadIdentity()
            GL.glTranslatef(shape.x, shape.y, 0)
            GL.glDrawArrays(GL.GL_QUADS, i * 8, 8)
        # GL.glDrawArrays(GL.GL_QUADS,
        #           0,
        #           self.rect_vbo.size)

        elapsed = time.time() - start
        print(elapsed)
开发者ID:apalm112,项目名称:arcade,代码行数:30,代码来源:a_quick_test5.py


示例5: update_display

def update_display(verts,tex_coords,texture=bird_texture):
    gl.glClearColor(0.2, 0.4, 0.5, 1.0)

    gl.glEnable(texture.target)
    gl.glBindTexture(texture.target, texture.id)

    gl.glPushAttrib(gl.GL_COLOR_BUFFER_BIT)
   
    gl.glEnable(gl.GL_ALPHA_TEST)                                                            
    gl.glAlphaFunc (gl.GL_GREATER, .1)                             
    #gl.glEnable(gl.GL_BLEND)                                                            
    #gl.glBlendFunc (gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA)                             
    gl.glEnable(gl.GL_DEPTH_TEST) 

    gl.glEnableClientState(gl.GL_VERTEX_ARRAY)
    gl.glEnableClientState(gl.GL_TEXTURE_COORD_ARRAY)

    n=len(verts[:])
    #TODO verts._buffer.ctypes.data is awkward
    gl.glVertexPointer(3, vert_dtype.gl, 0, verts[:].ctypes.data)
    gl.glTexCoordPointer(3, tex_dtype.gl, 0, tex_coords[:].ctypes.data)
    gl.glDrawArrays(gl.GL_TRIANGLE_STRIP, 0, n)
    #unset state
    gl.glPopAttrib()
    gl.glDisable(texture.target)
开发者ID:Permafacture,项目名称:data-oriented-pyglet,代码行数:25,代码来源:animated_test.py


示例6: __init__

    def __init__(self):
        pts = generate_cyl_points().T

        colors = np.zeros_like(pts)
        colors[:,1]=1.0 # all green

        n_pts = len(pts)
        pts = map(float,pts.flat) # convert to flat list of floats
        colors = map(float, colors.flat)

        # Create ctypes arrays of the lists
        vertices = (gl.GLfloat * (n_pts*3))(*pts)
        colors = (gl.GLfloat * (n_pts*3))(*colors)

        # Create a list of triangle indices.
        indices = range(n_pts)
        indices = (gl.GLuint * n_pts)(*indices)

        # Compile a display list
        self.list = gl.glGenLists(1)
        gl.glNewList(self.list, gl.GL_COMPILE)

        gl.glPushClientAttrib(gl.GL_CLIENT_VERTEX_ARRAY_BIT)
        gl.glEnableClientState(gl.GL_VERTEX_ARRAY)
        gl.glVertexPointer(3, gl.GL_FLOAT, 0, vertices)
        gl.glEnableClientState(gl.GL_COLOR_ARRAY)
        gl.glColorPointer(3, gl.GL_FLOAT, 0, colors)
        gl.glDrawElements(gl.GL_POINTS, len(indices), gl.GL_UNSIGNED_INT, indices)
        gl.glPopClientAttrib()

        gl.glEndList()
开发者ID:caomw,项目名称:opengl-hz,代码行数:31,代码来源:calib_test_pyglet.py


示例7: on_draw

    def on_draw(self):
        """
        Render the screen.
        """
        start = time.time()

        GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT)
        GL.glMatrixMode(GL.GL_MODELVIEW)
        GL.glDisable(GL.GL_BLEND)

        GL.glBindBuffer(GL.GL_ARRAY_BUFFER, self.vertex_vbo_id)
        GL.glEnableClientState(GL.GL_VERTEX_ARRAY)
        GL.glVertexPointer(2, GL.GL_FLOAT, 0, 0)

        GL.glBindBuffer(GL.GL_ARRAY_BUFFER, self.color_vbo_id)
        GL.glEnableClientState(GL.GL_COLOR_ARRAY)
        GL.glColorPointer(3, GL.GL_FLOAT, 0, 0)

        offset = 0
        for shape in self.shape_list:
            render_rect_filled(shape, offset)
            offset += 4

        elapsed = time.time() - start
        print(elapsed)
开发者ID:apalm112,项目名称:arcade,代码行数:25,代码来源:vbo_test_04.py


示例8: draw_bounding_box

    def draw_bounding_box(self, x, y, screen_height):
        bb = self.get_bounding_box()
        bb = [bb['min_x'], bb['min_y'], bb['max_x'], bb['max_y']]
        vertices = ()
        for _ in bb:
            vertices += (_.x,)
            vertices += (screen_height - _.y,)

        # get opengl vertices of type GLfloat
        vertices_gl = (GLfloat * len(vertices))(*vertices)

        # set the color
        glColor4ub(0, 255, 0, 255);
        glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );

        # turn on blend for alpha channel
        glEnable(GL_BLEND)

        # tell open GL were passing a vertex array
        glEnableClientState(GL_VERTEX_ARRAY)

        # create a pointer to vertices_gl
        glVertexPointer(2, GL_FLOAT, 0, vertices_gl)
       
        # draw the array
        glDrawArrays(GL_POLYGON, 0, len(vertices) // 2)

        glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
开发者ID:bm1362,项目名称:atlas-py,代码行数:28,代码来源:RigidBody.py


示例9: start_render

def start_render():
    """
    Get set up to render. Required to be called before drawing anything to the
    screen.
    """
    gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT)
    gl.glMatrixMode(gl.GL_MODELVIEW)
    gl.glEnableClientState(gl.GL_VERTEX_ARRAY)
开发者ID:mikemhenry,项目名称:arcade,代码行数:8,代码来源:window_commands.py


示例10: __init__

    def __init__(self, radius, inner_radius, slices, inner_slices):
        # Create the vertex and normal arrays.
        vertices = []
        normals = []

        u_step = 2 * pi / (slices - 1)
        v_step = 2 * pi / (inner_slices - 1)
        u = 0.
        for i in range(slices):
            cos_u = cos(u)
            sin_u = sin(u)
            v = 0.
            for j in range(inner_slices):
                cos_v = cos(v)
                sin_v = sin(v)

                d = (radius + inner_radius * cos_v)
                x = d * cos_u
                y = d * sin_u
                z = inner_radius * sin_v

                nx = cos_u * cos_v
                ny = sin_u * cos_v
                nz = sin_v

                vertices.extend([x, y, z])
                normals.extend([nx, ny, nz])
                v += v_step
            u += u_step

        # Create ctypes arrays of the lists
        vertices = (GLfloat * len(vertices))(*vertices)
        normals = (GLfloat * len(normals))(*normals)

        # Create a list of triangle indices.
        indices = []
        for i in range(slices - 1):
            for j in range(inner_slices - 1):
                p = i * inner_slices + j
                indices.extend([p, p + inner_slices, p + inner_slices + 1])
                indices.extend([p, p + inner_slices + 1, p + 1])
        indices = (GLuint * len(indices))(*indices)

        # Compile a display list
        self.list = glGenLists(1)
        glNewList(self.list, GL_COMPILE)

        glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT)
        glEnableClientState(GL_VERTEX_ARRAY)
        glEnableClientState(GL_NORMAL_ARRAY)
        glVertexPointer(3, GL_FLOAT, 0, vertices)
        glNormalPointer(GL_FLOAT, 0, normals)
        glDrawElements(GL_TRIANGLES, len(indices), GL_UNSIGNED_INT, indices)
        glPopClientAttrib()

        glEndList()
开发者ID:encukou,项目名称:pyglet_helper,代码行数:56,代码来源:opengl.py


示例11: display

    def display(self, mode_2d=False):
        glPushMatrix()
        glTranslatef(self.offset_x, self.offset_y, 0)
        glEnableClientState(GL_VERTEX_ARRAY)
        glEnableClientState(GL_COLOR_ARRAY)

        self._display_movements(mode_2d)

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


示例12: __enter__

 def __enter__(self):
     for idx in self.state:
         texuint = 0
         if hasattr(idx, "__len__"):
             texunit = idx[1]
             idx = idx[0]
         if idx in self.ClientState:
             if idx == gl.GL_TEXTURE_COORD_ARRAY:
                 gl.glClientActiveTexture(GL_TEXTURE0 + texunit)
             gl.glEnableClientState(idx)
         else:
             gl.glEnable(idx)
开发者ID:znah,项目名称:yoxel-voxel,代码行数:12,代码来源:zgl2.py


示例13: draw

    def draw(self):
        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.glEnableClientState(gl.GL_VERTEX_ARRAY)
        gl.glEnableClientState(gl.GL_COLOR_ARRAY)

        #TODO verts._buffer.ctypes.data is awkward
        gl.glVertexPointer(2, self.vert_dtype.gl, 0, self.verts._buffer.ctypes.data)
        gl.glColorPointer(3,  self.color_dtype.gl, 0, self.colors._buffer.ctypes.data)
        gl.glDrawArrays(gl.GL_TRIANGLE_STRIP, 0, len(self.verts._buffer)//2)
开发者ID:Toaki,项目名称:data-oriented-pyglet,代码行数:12,代码来源:data_oriented.py


示例14: draw_hud

    def draw_hud(self):
        '''
        Draw any display items overlaid on the world, such as FPS counter
        '''
        self.projection.set_screen()
        self.modelview.set_identity()
        gl.glEnableClientState(gl.GL_VERTEX_ARRAY)
        gl.glEnableClientState(gl.GL_COLOR_ARRAY)

        self.clock_display.draw()

        gl.glDisableClientState(gl.GL_VERTEX_ARRAY)
        gl.glDisableClientState(gl.GL_COLOR_ARRAY)
开发者ID:tartley,项目名称:gloopy,代码行数:13,代码来源:render.py


示例15: update_display

def update_display(render_verts, colors):
    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.glEnableClientState(gl.GL_VERTEX_ARRAY)
    gl.glEnableClientState(gl.GL_COLOR_ARRAY)

    n = len(render_verts[:])
    # TODO verts._buffer.ctypes.data is awkward
    gl.glVertexPointer(3, vert_dtype.gl, 0, render_verts[:].ctypes.data)
    gl.glColorPointer(3, color_dtype.gl, 0, colors[:].ctypes.data)
    gl.glDrawArrays(gl.GL_TRIANGLE_STRIP, 0, n)
开发者ID:Permafacture,项目名称:data-oriented-pyglet,代码行数:13,代码来源:add-delete.py


示例16: draw

def draw(verts,colors):
    '''draw the numpy arrays `verts` and `colors`.'''

    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.glEnableClientState(gl.GL_VERTEX_ARRAY)
    gl.glEnableClientState(gl.GL_COLOR_ARRAY)

    gl.glVertexPointer(2, vert_dtype.gl_type, 0, verts.ctypes.data)
    gl.glColorPointer(3,  color_dtype.gl_type, 0, colors.ctypes.data)
    gl.glDrawArrays(gl.GL_TRIANGLE_STRIP, 0, len(verts)//2)
    fps_display.draw()
开发者ID:Toaki,项目名称:data-oriented-pyglet,代码行数:14,代码来源:third.py


示例17: render_points

    def render_points(self):
        renderPoints = []
        for point in self.points:
            renderPoints.extend(point.position.vector)

        self.ctPoints = (gl.GLfloat * len(renderPoints))(*renderPoints)

        point_ptr = ct.cast(self.ctPoints, ct.c_void_p)

        gl.glColor3f(1.0, 1.0, 1.0)
        gl.glEnableClientState(gl.GL_VERTEX_ARRAY)
        gl.glVertexPointer(2, gl.GL_FLOAT, 0, point_ptr)
        gl.glDrawArrays(gl.GL_POINTS, 0, len(renderPoints)//2)
        gl.glDisableClientState(gl.GL_VERTEX_ARRAY)
开发者ID:mdsitton,项目名称:the-awakening,代码行数:14,代码来源:game.py


示例18: on_draw

    def on_draw(self):
        """
        Render the screen.
        """
        start = time.time()

        GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT)
        GL.glMatrixMode(GL.GL_MODELVIEW)
        GL.glEnableClientState(GL.GL_VERTEX_ARRAY)

        for shape in self.shape_list:
            shape.draw()

        elapsed = time.time() - start
        print(elapsed)
开发者ID:apalm112,项目名称:arcade,代码行数:15,代码来源:vbo_test_01.py


示例19: drawlines

    def drawlines( self, verts, colors, idxs ):
        'helper to draw lines from numpy arrays of verts/colors/indexes'
        vptr = vecutil.numpy2pointer(verts)
        iptr = vecutil.numpy2pointer(idxs)

        if colors is not None:
            cptr = vecutil.numpy2pointer(colors)
            gl.glEnableClientState(gl.GL_COLOR_ARRAY)
            gl.glColorPointer(3, gl.GL_FLOAT, 0, cptr)

        gl.glEnableClientState(gl.GL_VERTEX_ARRAY)
        gl.glVertexPointer(3, gl.GL_FLOAT, 0, vptr)
        gl.glDrawElements(gl.GL_LINES, len(idxs), gl.GL_UNSIGNED_INT, iptr)
        gl.glDisableClientState(gl.GL_VERTEX_ARRAY)
        gl.glDisableClientState(gl.GL_COLOR_ARRAY)
开发者ID:manishjakhodecdn,项目名称:skyseam,代码行数:15,代码来源:viewer.py


示例20: start_render

def start_render():
    """
    Get set up to render. Required to be called before drawing anything to the
    screen.

    Args:
        None
    Returns:
        None
    Raises:
        None
    """
    GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT)
    GL.glMatrixMode(GL.GL_MODELVIEW)
    GL.glEnableClientState(GL.GL_VERTEX_ARRAY)
开发者ID:apalm112,项目名称:arcade,代码行数:15,代码来源:window_commands.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python gl.glEnd函数代码示例发布时间:2022-05-25
下一篇:
Python gl.glEnable函数代码示例发布时间: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