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

Python gl.glDisable函数代码示例

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

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



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

示例1: on_draw

 def on_draw(self):
     self.window.clear()
     gl.glMatrixMode(gl.GL_PROJECTION)
     gl.glPushMatrix()
     gl.glLoadIdentity()
     self.camera()
     gl.glEnable(self.grass.target)
     gl.glEnable(gl.GL_BLEND)
     gl.glBindTexture(self.grass.target, self.grass.id)
     W = 10000.
     graphics.draw(4, gl.GL_QUADS,
         ('v2f', (-W, -W, W, -W, W, W, -W, W)),
         ('t2f', (0., 0., W*5., 0., W*5., W*5., 0., W*5.))
     )
     gl.glDisable(self.grass.target)
     for lane in self.lanes:
         self.draw_lane_surface(lane)
     for lane in self.lanes:
         self.draw_lane_lines(lane)
     for obj in self.objects:
         self.draw_object(obj)
     for car in self.cars:
         if car!=self.main_car and car not in self.visible_cars:
             self.draw_car(self.anim_x[car], car.color)
     if self.heat is not None:
         self.draw_heatmap()
     for car in self.cars:
         if car==self.main_car or car in self.visible_cars:
             self.draw_car(self.anim_x[car], car.color)
     gl.glPopMatrix()
     if isinstance(self.main_car, Car):
         self.label.text = 'Speed: %.2f'%self.anim_x[self.main_car][3]
         self.label.draw()
     if self.output is not None:
         pyglet.image.get_buffer_manager().get_color_buffer().save(self.output.format(self.frame))
开发者ID:dsadigh,项目名称:Autonomous_Driving,代码行数:35,代码来源:visualize.py


示例2: set_3d

    def set_3d(self):
        """ Configure OpenGL to draw in 3d.

        """
        width, height = self.get_size()

        gl.glEnable(gl.GL_DEPTH_TEST)

        gl.glViewport(0, 0, width, height)
        gl.glMatrixMode(gl.GL_PROJECTION)
        gl.glLoadIdentity()
        gl.gluPerspective(65.0, width / float(height), 0.1, DIST)
        gl.glMatrixMode(gl.GL_MODELVIEW)
        gl.glLoadIdentity()

        x, y = self.rotation
        gl.glRotatef(x, 0, 1, 0)
        gl.glRotatef(-y, math.cos(math.radians(x)), 0, math.sin(math.radians(x)))
        x, y, z = self.position
        gl.glTranslatef(-x, -y, -z)

        gl.glEnable(gl.GL_LIGHTING)
        gl.glLightModelfv(gl.GL_LIGHT_MODEL_AMBIENT, GLfloat4(0.05,0.05,0.05,1.0))
        gl.glEnable(gl.GL_COLOR_MATERIAL)
        gl.glColorMaterial(gl.GL_FRONT, gl.GL_AMBIENT_AND_DIFFUSE)
        #gl.glLightfv(gl.GL_LIGHT1,gl.GL_SPOT_DIRECTION, GLfloat3(0,0,-1))
        gl.glLightfv(gl.GL_LIGHT1, gl.GL_AMBIENT, GLfloat4(0.5,0.5,0.5,1.0))
        gl.glLightfv(gl.GL_LIGHT1, gl.GL_DIFFUSE, GLfloat4(1.0,1.0,1.0,1.0))
        gl.glLightfv(gl.GL_LIGHT1, gl.GL_POSITION, GLfloat4(0.35,1.0,0.65,0.0))
        #gl.glLightfv(gl.GL_LIGHT0,gl.GL_SPECULAR, GLfloat4(1,1,1,1))
        gl.glDisable(gl.GL_LIGHT0)
        gl.glEnable(gl.GL_LIGHT1)
开发者ID:spillz,项目名称:minepy,代码行数:32,代码来源:main.py


示例3: setup

 def setup(self):
   # One-time GL setup
   gl.glClearColor(1, 1, 1, 0)
   gl.glColor3f(1, 0, 0)
   gl.glEnable(gl.GL_DEPTH_TEST)
   gl.glEnable(gl.GL_CULL_FACE)
   gl.glDisable(gl.GL_LIGHTING)
开发者ID:mnzaki,项目名称:dlogical,代码行数:7,代码来源:circuit_drawing_area.py


示例4: display

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

            has_vbo = isinstance(self.vertex_buffer, VertexBufferObject)
            if self.display_travels:
                self._display_travels(has_vbo)

            glEnable(GL_LIGHTING)
            glEnableClientState(GL_NORMAL_ARRAY)
            glEnableClientState(GL_COLOR_ARRAY)
            glMaterialfv(GL_FRONT, GL_SPECULAR, vec(1, 1, 1, 1))
            glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, vec(0, 0, 0, 0))
            glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 50)

            glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE)
            self._display_movements(has_vbo)

            glDisable(GL_LIGHTING)

            glDisableClientState(GL_COLOR_ARRAY)
            glDisableClientState(GL_VERTEX_ARRAY)
            glDisableClientState(GL_NORMAL_ARRAY)

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


示例5: blit_buffer

    def blit_buffer(self, framebuffer, parent_width, parent_height, **kwargs):
        """Draw the texture into the parent scene

        .. warning:

            This method's arguments are not part of the API yet and may change
            at any time.
        """
        gl.glViewport(0, 0, parent_width, parent_height)

        gl.glTexParameteri(gl.GL_TEXTURE_2D,
            gl.GL_TEXTURE_MAG_FILTER, gl.GL_NEAREST)
        gl.glBindTexture(gl.GL_TEXTURE_2D, framebuffer.texture_id)
        gl.glEnable(gl.GL_TEXTURE_2D)

        gl.glColor4fv((gl.GLfloat * 4)(*self.color + (self.opacity, )))
        gl.glBlendFunc(gl.GL_ONE, gl.GL_ONE_MINUS_SRC_ALPHA)  # premultipl.
        gl.glBegin(gl.GL_TRIANGLE_STRIP)
        gl.glTexCoord2f(0, 0)
        gl.glVertex2i(0, 0)
        gl.glTexCoord2f(0, parent_height)
        gl.glVertex2i(0, parent_height)
        gl.glTexCoord2f(parent_width, 0)
        gl.glVertex2i(parent_width, 0)
        gl.glTexCoord2f(parent_width, parent_height)
        gl.glVertex2i(parent_width, parent_height)
        gl.glEnd()
        gl.glTexParameteri(gl.GL_TEXTURE_2D,
            gl.GL_TEXTURE_MAG_FILTER, gl.GL_LINEAR)
        gl.glDisable(gl.GL_TEXTURE_2D)
        gl.glTexParameteri(gl.GL_TEXTURE_2D,
            gl.GL_TEXTURE_MAG_FILTER, gl.GL_NEAREST)
        gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA)

        gl.glViewport(0, 0, parent_width, parent_height)
开发者ID:encukou,项目名称:gillcup_graphics,代码行数:35,代码来源:effectlayer.py


示例6: create_window

 def create_window(self, _iScr=0, _title="", _dx=0, _dy=0, _left=0, _top=0,
                   _scale=1.0, _isScrOvl=False, _iScrGUI=0, _offset=(0,0)):
   """ If the renderer was initialized, create a window instance and store
       it in the internal window list. For parameters, see Window class.
   """
   if self.isReady:
     self.winList.append(Window(self, _iScr, _title, _dx, _dy, _left, _top,
                                _scale, _isScrOvl, _iScrGUI, _offset))    
     '''
     if len(self.winList) == 1:
     # Is the first window, set some general OpenGL properties
     #
     '''
     GL.glClearColor(0., 0., 0., 0.)
     GL.glColor3f(1., 1., 1.)
     GL.glDisable(GL.GL_DEPTH_TEST)
     GL.glEnable(GL.GL_BLEND)
     GL.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA)
     '''
     GL.glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)
     GL.glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)
 
     GL.glShadeModel(GL_FLAT) # GL_FLAT or GL_SMOOTH
     GL.glEnable(GL_POINT_SMOOTH)
     '''
     return self.winList[-1]
   else:  
     return None
开发者ID:eulerlab,项目名称:QDSpy,代码行数:28,代码来源:renderer_opengl.py


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


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


示例9: enable_states

def enable_states(gl_states):
    """Context Manager that calls glEnable and glDisable on a list of gl states."""
    for state in gl_states:
        gl.glEnable(state)
    yield
    for state in gl_states:
        gl.glDisable(state)
开发者ID:NicolasKuske,项目名称:ratcave,代码行数:7,代码来源:gl.py


示例10: circle

def circle(pos, radius, color=(1.0,1.0,1.0), alpha=1.0,segments=6):
    """
    Draws a circle with gluDisk 
    
    :param pos: center of the circle
    :type pos: 2-float tuple

    :param radius: radius of the circle
    :type radius: float

    :param color: the color in [0..1] range
    :type color: 3-float tuple

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

    :param segments: number of segments
    :type segments: int

    """

    glDisable(GL_TEXTURE_2D)

    c = gluNewQuadric()
    glColor4f(color[0], color[1], color[2], alpha)
    glPushMatrix()
    glTranslatef(pos[0], pos[1], 0)
    gluDisk(c, 0, radius, segments, 1)
    glPopMatrix()
    glColor4f(1.0,1.0,1.0,1.0)
    glEnable(GL_TEXTURE_2D)
开发者ID:xoryouyou,项目名称:NetArgos,代码行数:30,代码来源:pool.py


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


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


示例13: draw

    def draw(self):
        from miru.context import context
        gl.glEnable(gl.GL_LINE_STIPPLE)
        gl.glLineStipple(1, 0x51315)
        gl.glColor4f(*self.color)
        for c in self.metaCamera.cameras:

            vp = c.projection

            x = vp.x == 0 and 1 or vp.x
            width = vp.x == 0 and vp.width - 1 or vp.width
            width = (vp.x + vp.width) >= context.window.width and width - 1 or width

            y = vp.y == 0 and 1 or vp.y
            height = vp.y == 0 and vp.height - 1 or vp.height
            height = (vp.y + vp.height) >= context.window.height and height - 1 or height

            gl.glBegin(gl.GL_LINE_LOOP)
            gl.glVertex2f(x, y)
            gl.glVertex2f(x, y + height)
            gl.glVertex2f(x + width, y + height)
            gl.glVertex2f(x + width, y)
            gl.glEnd()
        gl.glDisable(gl.GL_LINE_LOOP)
        gl.glColor4f(1,1,1,1)
开发者ID:Knio,项目名称:miru,代码行数:25,代码来源:camera.py


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


示例15: poll

    def poll(dt):
        out = next(itr, False)
        if out is False:
            if args.pause:
                label.text = "Done. ('q' to quit)"
            else:
                pyglet.app.exit()
        elif out is not None:
            name, buf = out
            real_dt = time.time() - last_time[0]
            last_time[0] = time.time()
            if buf.dtype == np.uint8:
                fmt = gl.GL_UNSIGNED_BYTE
            elif buf.dtype == np.uint16:
                fmt = gl.GL_UNSIGNED_SHORT
            else:
                label.text = 'Unsupported format: ' + buf.dtype
                return

            h, w, ch = buf.shape
            gl.glEnable(tex.target)
            gl.glBindTexture(tex.target, tex.id)
            gl.glTexImage2D(tex.target, 0, gl.GL_RGB8, w, h, 0, gl.GL_RGBA,
                            fmt, buf.tostring())
            gl.glDisable(tex.target)
            label.text = '%s (%g fps)' % (name, 1./real_dt)
        else:
            label.text += '.'
开发者ID:gijzelaerr,项目名称:cuburn,代码行数:28,代码来源:main.py


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


示例17: _set_backface_culling

 def _set_backface_culling(self, value):
     self._backface_culling = value
     if self._backface_culling:
         gl.glCullFace(gl.GL_BACK)
         gl.glEnable(gl.GL_CULL_FACE)
     else:
         gl.glDisable(gl.GL_CULL_FACE)
开发者ID:tartley,项目名称:gloopy,代码行数:7,代码来源:render.py


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


示例19: display

 def display(self, mode_2d=False):
     glEnable(GL_LINE_SMOOTH)
     orig_linewidth = (GLfloat)()
     glGetFloatv(GL_LINE_WIDTH, orig_linewidth)
     glLineWidth(3.0)
     glCallList(self.display_list)
     glLineWidth(orig_linewidth)
     glDisable(GL_LINE_SMOOTH)
开发者ID:MakotoEZURE,项目名称:Printrun,代码行数:8,代码来源:actors.py


示例20: postDraw

    def postDraw(self):
        """Called right after this layer draws; should revert any changes from
        preDraw()."""
        self._layerProjectLocalToScreenUndo()

        if self._scissorBox is not None:
            gl.glDisable(gl.GL_SCISSOR_TEST)

        frameCachedProperty.clear(self)
开发者ID:wwoods,项目名称:pyglet_piss,代码行数:9,代码来源:layer.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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