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

Python gl.glPopAttrib函数代码示例

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

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



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


示例16: render

    def render(self):
        gl.glPushAttrib(gl.GL_ENABLE_BIT)
        gl.glEnable(gl.GL_BLEND)
        gl.glDisable(gl.GL_DEPTH_TEST)
        gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA)

        gl.glEnable(gl.GL_TEXTURE_2D)
        gl.glPushClientAttrib(gl.GL_CLIENT_VERTEX_ARRAY_BIT)

        for o in self.objects:
            o.draw()

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


示例17: draw

 def draw(self):
     glPushMatrix()
     glPushAttrib(GL_STENCIL_BUFFER_BIT)
     glClear(GL_STENCIL_BUFFER_BIT)
     glTranslatef(self.parent.x, self.parent.y, 0)
     glDisable(GL_TEXTURE_2D)
     loader = self.loader
     if loader.shape == LINE_SHAPE:
         glEnable(GL_LINE_SMOOTH)
         glEnable(GL_POINT_SMOOTH)
         glLineWidth(loader.borderSize)
         glPointSize(loader.borderSize)
         self.vertex.draw(GL_LINES)
         self.vertex.draw(GL_POINTS)
     elif loader.shape == RECTANGLE_SHAPE:
         width = self.parent.width
         height = self.parent.height
         if loader.fillType != NONE_FILL:
             # for counters
             if self.counter_stencil:
                 glEnable(GL_STENCIL_TEST)
                 glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE)
                 glStencilFunc(GL_ALWAYS, 1, 1)
                 glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE)
                 self.counter_stencil.draw(GL_QUADS)
                 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE)
                 glStencilFunc(GL_EQUAL, 1, 1)
                 self.draw_rectangle()
                 glDisable(GL_STENCIL_TEST)
             else:
                 self.draw_rectangle()
         if self.border is not None:
             self.border.draw(GL_QUADS)
     elif loader.shape == ELLIPSE_SHAPE:
         if loader.fillType != NONE_FILL:
             glEnable(GL_STENCIL_TEST)
             glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE)
             glStencilFunc(GL_ALWAYS, 1, 1)
             glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE)
             self.stencil.draw(GL_TRIANGLES)
             glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE)
             glStencilFunc(GL_EQUAL, 1, 1)
             self.draw_rectangle(True)
             glDisable(GL_STENCIL_TEST)
         if self.border:
             self.border.draw(GL_QUADS)
     glPopAttrib()
     glPopMatrix()
开发者ID:carriercomm,项目名称:anaconda,代码行数:48,代码来源:shape.py


示例18: draw_image

    def draw_image(self, img, rect=None, force_copy=False):
        """ Renders a GraphicsContextArray into this GC """
        xform = self.get_ctm()
        x0 = xform[4]
        y0 = xform[5]

        image = image_as_array(img)
        shape = image.shape
        if shape[2] == 4:
            fmt = "RGBA"
        else:
            fmt = "RGB"
        aii = ArrayImage(image, format=fmt)
        texture = aii.texture

        # The texture coords consists of (u,v,r) for each corner of the
        # texture rectangle.  The coordinates are stored in the order
        # bottom left, bottom right, top right, top left.
        x, y, w, h = rect
        texture.width = w
        texture.height = h
        t = texture.tex_coords
        points = array([
            [x,   y+h],
            [x+w, y+h],
            [x+w, y],
            [x,   y],
        ])
        p = transform_points(affine_from_values(*xform), points)
        a = (gl.GLfloat*32)(
            t[0],   t[1],   t[2],  1.,
            p[0,0], p[0,1], 0,     1.,
            t[3],   t[4],   t[5],  1.,
            p[1,0], p[1,1], 0,     1.,
            t[6],   t[7],   t[8],  1.,
            p[2,0], p[2,1], 0,     1.,
            t[9],   t[10],  t[11], 1.,
            p[3,0], p[3,1], 0,     1.,
        )
        gl.glPushAttrib(gl.GL_ENABLE_BIT)
        gl.glEnable(texture.target)
        gl.glBindTexture(texture.target, texture.id)
        gl.glPushClientAttrib(gl.GL_CLIENT_VERTEX_ARRAY_BIT)
        gl.glInterleavedArrays(gl.GL_T4F_V4F, 0, a)
        gl.glDrawArrays(gl.GL_QUADS, 0, 4)
        gl.glPopClientAttrib()
        gl.glPopAttrib()
开发者ID:GaZ3ll3,项目名称:enable,代码行数:47,代码来源:gl.py


示例19: blit_image

    def blit_image(self, matrix, position, scale, image):
        x, y = image.width * scale, image.height * scale
        # dx = self.x + position[0]
        # dy = self.y + position[1]
        dx, dy = position
        gl.glEnable(image.target)
        gl.glBindTexture(image.target, image.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)

        # blit img
        points = [
            (-dx, -dy),
            (x - dx, -dy),
            (x - dx, y - dy),
            (-dx, y - dy)
            ]
        a, b, _, c, d, _, e, f, _, g, h, _ = image.texture.tex_coords
        textures = [a, b, c, d, e, f, g, h]
        np = [matrix * euclid.Point2(*p) for p in points]

        gl.glColor4ub(255, 255, 255, self.alpha)
        gl.glBegin(gl.GL_QUADS)
        gl.glTexCoord2f(a, b)
        gl.glVertex2f(*np[0])
        gl.glTexCoord2f(c, d)
        gl.glVertex2f(*np[1])
        gl.glTexCoord2f(e, f)
        gl.glVertex2f(*np[2])
        gl.glTexCoord2f(g, h)
        gl.glVertex2f(*np[3])
        gl.glEnd()
        gl.glColor4ub(255, 255, 255, 255)
        # pyglet.graphics.draw(4, GL_QUADS,
        #     ("v2f", new_points),
        #     ("t2f", textures),
        #     ("c4B", [255, 255, 255, self.alpha] * 4),
        #     )

        gl.glPopAttrib()
        gl.glDisable(image.target)
开发者ID:fpietka,项目名称:cocos,代码行数:42,代码来源:skeleton.py


示例20: render

    def render(self):
        """Draw contained objects.
        """
        if not self.objects:
            return

        r = 32
        self._set_2d(0, r*4)
        gl.glPushAttrib(gl.GL_ENABLE_BIT)
        gl.glEnable(gl.GL_BLEND)
        gl.glDisable(gl.GL_DEPTH_TEST)
        gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA)
        
        import miru.graphics

        for v in self.objects:
            v.draw()
            #print '-- %r' % v
            #print '\n'.join([ str(t) for t in miru.graphics.TextureTool.current_parameters()])
        gl.glColor4f(1,1,1,1)
        gl.glPopAttrib()
        self._unset_2d()
开发者ID:Knio,项目名称:miru,代码行数:22,代码来源:osd2.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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