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


Python gl.glPushAttrib函数代码示例

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


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

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

示例2: set_state

    def set_state(self):
        gl.glPushAttrib(gl.GL_ENABLE_BIT | gl.GL_TRANSFORM_BIT | gl.GL_CURRENT_BIT)
        gl.glEnable(gl.GL_BLEND)
        gl.glBlendFuncSeparate(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA, gl.GL_ONE, gl.GL_ONE_MINUS_SRC_ALPHA)
        # To Allow Normal Rendering when Buffering with FrameBufferObject
        # Without this option : problem with alpha blending when rendering buffered GUI textures
        #Also in context.glContext

        # Disable clipping planes to check culling.
        gl.glEnable(gl.GL_CLIP_PLANE0)
        gl.glEnable(gl.GL_CLIP_PLANE1)
        gl.glEnable(gl.GL_CLIP_PLANE2)
        gl.glEnable(gl.GL_CLIP_PLANE3)
        # Left
        gl.glClipPlane(gl.GL_CLIP_PLANE0, (gl.GLdouble * 4)(
                    1, 0, 0, -(self._clip_x - 1)))
        # Top
        gl.glClipPlane(gl.GL_CLIP_PLANE1, (gl.GLdouble * 4)(
                    0, -1, 0, self._clip_y))
        # Right
        gl.glClipPlane(gl.GL_CLIP_PLANE2, (gl.GLdouble * 4)(
                    -1, 0, 0, self._clip_x + self._clip_width + 1))
        # Bottom
        gl.glClipPlane(gl.GL_CLIP_PLANE3, (gl.GLdouble * 4)(
                    0, 1, 0, -(self._clip_y - self._clip_height)))
        gl.glTranslatef(self.translate_x, self.translate_y, 0)
开发者ID:samcorcoran,项目名称:Kytten,代码行数:26,代码来源:override.py

示例3: set_state

 def set_state(self):
     """
     Ensure that blending is set.
     """
     gl.glPushAttrib(gl.GL_ENABLE_BIT | gl.GL_CURRENT_BIT)
     gl.glEnable(gl.GL_BLEND)
     gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA)
开发者ID:Norberg,项目名称:pyglet-gui,代码行数:7,代码来源:manager.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

    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

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

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

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


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