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


Python gl.glPopAttrib函数代码示例

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


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

示例1: draw

    def draw(self):
        if self._dirty:
            self._context = Context()
            self._parts = []
            self.free()
            self.render()
            self.build_vbo()
            self._dirty = False

        # set
        gl.glEnable(self._texture.target)
        gl.glBindTexture(self._texture.target, self._texture.id)
        gl.glPushAttrib(gl.GL_COLOR_BUFFER_BIT)

        gl.glEnable(gl.GL_BLEND)
        gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA)

        gl.glPushMatrix()
        self.transform()
        # cuadric.begin()
        self._vertex_list.draw(gl.GL_TRIANGLES)
        # cuadric.end()

        # unset
        gl.glPopMatrix()
        gl.glPopAttrib()
        gl.glDisable(self._texture.target)
开发者ID:1414648814,项目名称:cocos,代码行数:27,代码来源:draw.py

示例2: unset_state

 def unset_state(self):
     """
     Disables the scissor test
     """
     if not self.was_scissor_enabled:
         gl.glDisable(gl.GL_SCISSOR_TEST)
     gl.glPopAttrib()
开发者ID:ChrisNeveu,项目名称:CobraSketch,代码行数:7,代码来源:scrollable.py

示例3: draw

 def draw(self):
     if self._render_object:
         pgl.glPushAttrib(pgl.GL_ENABLE_BIT | pgl.GL_POLYGON_BIT | pgl.GL_DEPTH_BUFFER_BIT)
         if self._overlay:
             pgl.glDisable(pgl.GL_DEPTH_TEST)
         self._render_object.draw()
         pgl.glPopAttrib()
开发者ID:bjodah,项目名称:sympy,代码行数:7,代码来源:plot_axes.py

示例4: _draw

    def _draw(self):
        corner = c = self.octree.corner
        w = self.octree.width

        gl.glPushAttrib( gl.GL_ENABLE_BIT )
        gl.glEnable( gl.GL_COLOR_MATERIAL )

        if self.octree._child_nodes is None:
            if self.list_id:
                gl.glCallList(self.list_id)
            else:
                self.list_id = gl.glGenLists(1)
                gl.glNewList(self.list_id, gl.GL_COMPILE)

                gl.glColor3f(*self.color)
                gl.glBegin(gl.GL_LINE_LOOP)
                gl.glVertex3f(*c)
                gl.glVertex3f(*(c + (0,w,0)))
                gl.glVertex3f(*(c + (0,w,w)))
                gl.glVertex3f(*(c + (0,0,w)))
                gl.glEnd()

                c = corner + (w,0,0)

                gl.glBegin(gl.GL_LINE_LOOP)
                gl.glVertex3f(*c)
                gl.glVertex3f(*(c + (0,w,0)))
                gl.glVertex3f(*(c + (0,w,w)))
                gl.glVertex3f(*(c + (0,0,w)))
                gl.glEnd()

                gl.glBegin(gl.GL_LINES)
                gl.glVertex3f(*c)
                gl.glVertex3f(*(c - (w,0,0)))
                gl.glVertex3f(*(c + (0,w,0)))
                gl.glVertex3f(*(corner + (0,w,0)))
                gl.glVertex3f(*(c + (0,w,w)))
                gl.glVertex3f(*(corner + (0,w,w)))
                gl.glVertex3f(*(c + (0,0,w)))
                gl.glVertex3f(*(corner + (0,0,w)))
                gl.glEnd()

                gl.glEndList()

        # This could be optimized of course
        if self.octree._child_nodes is not None:
            r = self.color[0] + 0.14
            if r < 1.0:
                r = r % 1.0
            else:
                r = 1.0
            b = max((self.color[2] - 0.14), 0)
            for node in self.octree._child_nodes.values():
                if not self._cache.has_key(id(node)):
                    self._cache[id(node)] = OctreeDebug(node, color=(r,0,b))
                debugNode = self._cache[id(node)]
                debugNode._draw()
        gl.glColor3f(1,1,1)

        gl.glPopAttrib()
开发者ID:Knio,项目名称:miru,代码行数:60,代码来源:trees.py

示例5: _draw_wireframe_display_list

 def _draw_wireframe_display_list(self, dl):
     pgl.glPushAttrib(pgl.GL_ENABLE_BIT | pgl.GL_POLYGON_BIT)
     pgl.glPolygonMode(pgl.GL_FRONT_AND_BACK, pgl.GL_LINE)
     pgl.glEnable(pgl.GL_POLYGON_OFFSET_LINE)
     pgl.glPolygonOffset(-0.005, -50.0)
     pgl.glCallList(dl)
     pgl.glPopAttrib()
开发者ID:bjodah,项目名称:sympy,代码行数:7,代码来源:plot_mode_base.py

示例6: after_draw

    def after_draw(self, camera):
        """Called by CocosNode when the texture is already grabbed.
        The FrameBuffer will be unbound and the texture will be drawn

        :Parameters:
            `camera` : `Camera`
                The target's camera object.
        """

        # capture after drawing
        self.grabber.after_render(self.texture)

        # after unbinding
        # set a 3d projection
        self._set_3d_projection()

        # and center the camera
        camera.locate(force=True)

        # blit
        gl.glEnable(self.texture.target)
        gl.glBindTexture(self.texture.target, self.texture.id)

        gl.glPushAttrib(gl.GL_COLOR_BUFFER_BIT)

        self._blit()

        gl.glPopAttrib()
        gl.glDisable(self.texture.target)
开发者ID:los-cocos,项目名称:cocos,代码行数:29,代码来源:grid.py

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

示例8: buffer_texture

def buffer_texture(width, height):
    id_ = gl.GLuint()
    gl.glGenTextures(1, byref(id_))

    gl.glPushAttrib(gl.GL_ENABLE_BIT | gl.GL_TEXTURE_BIT)
    gl.glActiveTexture(gl.GL_TEXTURE0)
    gl.glEnable(gl.GL_TEXTURE_2D)

    gl.glBindTexture(gl.GL_TEXTURE_2D, id_)

    gl.glTexParameteri(gl.GL_TEXTURE_2D,
                       gl.GL_TEXTURE_MIN_FILTER,
                       gl.GL_LINEAR)
    gl.glTexParameteri(gl.GL_TEXTURE_2D,
                       gl.GL_TEXTURE_MAG_FILTER,
                       gl.GL_LINEAR)
    gl.glTexImage2D(
        gl.GL_TEXTURE_2D, 0, gl.GL_RGBA,
        width, height,
        0,
        gl.GL_RGBA, gl.GL_UNSIGNED_BYTE,
        (gl.GLubyte * (width*height * 4))(),
    )
    gl.glFlush()

    gl.glBindTexture(gl.GL_TEXTURE_2D, 0)
    gl.glPopAttrib()

    return id_
开发者ID:edne,项目名称:pineal,代码行数:29,代码来源:framebuffer.py

示例9: draw

 def draw(self):
     super(ColorLayer, self).draw()
     gl.glPushMatrix()
     self.transform()
     gl.glPushAttrib(gl.GL_CURRENT_BIT)
     self._batch.draw()
     gl.glPopAttrib()
     gl.glPopMatrix()
开发者ID:Victor01exe,项目名称:cocos,代码行数:8,代码来源:util_layers.py

示例10: unbind

 def unbind(self):
     from pyglet import gl
     gl.glMatrixMode(gl.GL_MODELVIEW)
     gl.glPopMatrix()
     gl.glMatrixMode(gl.GL_PROJECTION)
     gl.glPopMatrix()
     gl.glPopAttrib()
     gl.glBindFramebufferEXT(gl.GL_FRAMEBUFFER_EXT, 0)
     Framebuffer.current_fbo = None
开发者ID:feisuzhu,项目名称:thbattle,代码行数:9,代码来源:misc.py

示例11: unset_state

    def unset_state(self):
        '''
        Disables the scissor test
        '''
        if self._scale != 1.0:
            gl.glPopMatrix(gl.GL_MODELVIEW_MATRIX)

        if not self.was_scissor_enabled:
            gl.glDisable(gl.GL_SCISSOR_TEST)
        gl.glPopAttrib()
开发者ID:Parashurama,项目名称:Kytten,代码行数:10,代码来源:scrollable.py

示例12: draw

	def draw(self):
		self.update_global_coords()
		self.update_elements()
		
		gl.glPushAttrib(gl.GL_ENABLE_BIT)
		gl.glEnable(gl.GL_BLEND)
		gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA)
		
		self.batch.draw()
		
		gl.glPopAttrib()
开发者ID:hugosenari,项目名称:simplui,代码行数:11,代码来源:frame.py

示例13: bind_draw

 def bind_draw(self):
     """Context for drawing into the FBO"""
     with self._bound_context(gl.GL_FRAMEBUFFER_EXT) as parent_fb:
         # Set viewport to the size of the texture
         gl.glPushAttrib(gl.GL_VIEWPORT_BIT)
         try:
             gl.glViewport(0, 0, self.width, self.height)
             yield parent_fb
         finally:
             # Restore old viewport!
             gl.glPopAttrib()
开发者ID:encukou,项目名称:gillcup_graphics,代码行数:11,代码来源:fbo.py

示例14: _unset_view

    def _unset_view(self):
        gl.glMatrixMode(gl.GL_PROJECTION)
        gl.glPopMatrix()
        gl.glMatrixMode(self._mode.value)
        gl.glViewport(
            self._viewport[0],
            self._viewport[1],
            self._viewport[2],
            self._viewport[3],
        )

        gl.glPopAttrib()
开发者ID:mikedh,项目名称:trimesh,代码行数:12,代码来源:widget.py

示例15: draw_fallback

    def draw_fallback(self):
        """Called instead of :meth:`draw` when quads are used instead of
        Point Sprite.
        """
        self.make_delta_pos_to_vertex()
        self.update_vertexs_from_pos()
        self.update_per_vertex_colors()

        gl.glPushMatrix()
        self.transform()

        # color preserve - at least intel 945G needs that
        gl.glPushAttrib(gl.GL_CURRENT_BIT)

        gl.glEnable(gl.GL_TEXTURE_2D)
        gl.glBindTexture(gl.GL_TEXTURE_2D, self.texture.id)

        gl.glEnableClientState(gl.GL_VERTEX_ARRAY)
        vertexs_ptr = PointerToNumpy(self.vertexs)
        gl.glVertexPointer(2, gl.GL_FLOAT, 0, vertexs_ptr)

        gl.glEnableClientState(gl.GL_COLOR_ARRAY)
        color_ptr = PointerToNumpy(self.per_vertex_colors)
        # gl.glColorPointer(4, gl.GL_UNSIGNED_BYTE, 0, color_ptr)
        gl.glColorPointer(4, gl.GL_FLOAT, 0, color_ptr)

        gl.glEnableClientState(gl.GL_TEXTURE_COORD_ARRAY)
        tex_coord_ptr = PointerToNumpy(self.tex_coords)
        gl.glTexCoordPointer(2, gl.GL_FLOAT, 0, tex_coord_ptr)

        gl.glPushAttrib(gl.GL_COLOR_BUFFER_BIT)
        gl.glEnable(gl.GL_BLEND)
        if self.blend_additive:
            gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE)
        else:
            gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA)

        gl.glDrawArrays(gl.GL_QUADS, 0, len(self.vertexs) * 4)

        # un -blend
        gl.glPopAttrib()

        # color restore
        gl.glPopAttrib()

        # disable states
        gl.glDisableClientState(gl.GL_TEXTURE_COORD_ARRAY)
        gl.glDisableClientState(gl.GL_COLOR_ARRAY)
        gl.glDisableClientState(gl.GL_VERTEX_ARRAY)
        gl.glDisable(gl.GL_TEXTURE_2D)

        gl.glPopMatrix()
开发者ID:fpietka,项目名称:cocos,代码行数:52,代码来源:particle.py


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