當前位置: 首頁>>代碼示例>>Python>>正文


Python gl.glDisable方法代碼示例

本文整理匯總了Python中pyglet.gl.glDisable方法的典型用法代碼示例。如果您正苦於以下問題:Python gl.glDisable方法的具體用法?Python gl.glDisable怎麽用?Python gl.glDisable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pyglet.gl的用法示例。


在下文中一共展示了gl.glDisable方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: draw_triangle_left

# 需要導入模塊: from pyglet import gl [as 別名]
# 或者: from pyglet.gl import glDisable [as 別名]
def draw_triangle_left(self):
        if self.show_triangle_left:
            w = 200
            h = 200
            x = self.window.width // 4 - w // 2
            y = (self.window.height - h) // 2

            gl.glEnable(gl.GL_DEPTH_TEST)
            gl.glBegin(gl.GL_TRIANGLES)
            gl.glColor4f(1, 0, 0, 1)
            gl.glVertex3f(x, y, -1)
            gl.glColor4f(0, 1, 0, 1)
            gl.glVertex3f(x+w, y, 0)
            gl.glColor4f(0, 0, 1, 1)
            gl.glVertex3f(x, y+h, 1)
            gl.glEnd()
            gl.glDisable(gl.GL_DEPTH_TEST)
            gl.glColor4f(1, 1, 1, 1) 
開發者ID:pyglet,項目名稱:pyglet,代碼行數:20,代碼來源:test_image.py

示例2: _setup_2d

# 需要導入模塊: from pyglet import gl [as 別名]
# 或者: from pyglet.gl import glDisable [as 別名]
def _setup_2d(self):
        w, h = self.get_size()
        gl.glDisable(gl.GL_DEPTH_TEST)

        viewport = self.get_viewport_size()
        gl.glViewport(0, 0, max(1, viewport[0]), max(1, viewport[1]))

        gl.glMatrixMode(gl.GL_PROJECTION)
        gl.glLoadIdentity()
        gl.glOrtho(0, max(1, w), 0, max(1, h), -1, 1)

        gl.glMatrixMode(gl.GL_MODELVIEW)
        gl.glLoadIdentity() 
開發者ID:PaddlePaddle,項目名稱:RLSchool,代碼行數:15,代碼來源:render.py

示例3: on_draw

# 需要導入模塊: from pyglet import gl [as 別名]
# 或者: from pyglet.gl import glDisable [as 別名]
def on_draw(self):
        self.window.clear()
        gl.glMatrixMode(gl.GL_PROJECTION)
        gl.glPushMatrix()
        gl.glLoadIdentity()
        self.camera()
        gl.glEnable(self.background.target)
        gl.glEnable(gl.GL_BLEND)
        gl.glBindTexture(self.background.target, self.background.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.background.target)
        for lane in self.world.lanes:
            self.draw_lane_surface(lane)
            self.draw_lane_lines(lane)
        for obj in self.world.objects:
            self.draw_object(obj)
        for car in self.world.cars:
            self.draw_car(car.trajectory[-1], car.color)
        gl.glPopMatrix()

        self.label.text = self.task_name
        self.label.draw()
        self.iter +=1
        if self.iter%10 == 0:
            print('Iterations: ', self.iter)
        if self.iter == self.max_iters:
            self.event_loop.exit() 
開發者ID:BerkeleyLearnVerify,項目名稱:VerifAI,代碼行數:33,代碼來源:simulator.py

示例4: set_2d

# 需要導入模塊: from pyglet import gl [as 別名]
# 或者: from pyglet.gl import glDisable [as 別名]
def set_2d(self, size):
        """Configure OpenGL to draw in 2d."""
        width, height = size
        GL.glDisable(GL.GL_DEPTH_TEST)
        GL.glViewport(0, 0, width, height)
        GL.glMatrixMode(GL.GL_PROJECTION)
        GL.glLoadIdentity()
        GL.glOrtho(0, width, 0, height, -1, 1)
        GL.glMatrixMode(GL.GL_MODELVIEW)
        GL.glLoadIdentity() 
開發者ID:traverseda,項目名稱:pycraft,代碼行數:12,代碼來源:gs_running.py

示例5: _unbind_texture

# 需要導入模塊: from pyglet import gl [as 別名]
# 或者: from pyglet.gl import glDisable [as 別名]
def _unbind_texture(self, i):
        gl.glActiveTexture((gl.GL_TEXTURE0, gl.GL_TEXTURE1, gl.GL_TEXTURE2)[i])
        gl.glDisable(gl.GL_TEXTURE_2D) 
開發者ID:pyglet,項目名稱:pyglet,代碼行數:5,代碼來源:test_multitexture.py

示例6: unset_state

# 需要導入模塊: from pyglet import gl [as 別名]
# 或者: from pyglet.gl import glDisable [as 別名]
def unset_state(self):
        gl.glDisable(gl.GL_POLYGON_SMOOTH)
        gl.glDisable(gl.GL_BLEND) 
開發者ID:honix,項目名稱:Pyno,代碼行數:5,代碼來源:draw.py

示例7: quad_aligned

# 需要導入模塊: from pyglet import gl [as 別名]
# 或者: from pyglet.gl import glDisable [as 別名]
def quad_aligned(x, y, w, h, color):
    quad_data = pyglet.graphics.vertex_list_indexed(
                 4,
                 [0, 1, 2, 2, 3, 0],
                 ('v2i', (x, y,
                          x + w, y,
                          x + w, y + h,
                          x, y + h)),
                 ('c4B', color * 4))

    gl.glEnable(gl.GL_BLEND)
    quad_data.draw(pyglet.gl.GL_TRIANGLES)
    gl.glDisable(gl.GL_BLEND) 
開發者ID:honix,項目名稱:Pyno,代碼行數:15,代碼來源:draw.py

示例8: selector

# 需要導入模塊: from pyglet import gl [as 別名]
# 或者: from pyglet.gl import glDisable [as 別名]
def selector(init, corner):
    '''Selection tool representation'''
    quad_data = pyglet.graphics.vertex_list_indexed(
                 4,
                 [0, 1, 2, 2, 3, 0],
                 ('v2i', (init[0],   init[1],
                          corner[0], init[1],
                          corner[0], corner[1],
                          init[0],   corner[1])),
                 ('c4B', (120, 200, 255, 50) * 4))

    # glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
    gl.glEnable(gl.GL_BLEND)
    quad_data.draw(gl.GL_TRIANGLES)
    gl.glDisable(gl.GL_BLEND) 
開發者ID:honix,項目名稱:Pyno,代碼行數:17,代碼來源:draw.py

示例9: show_drone

# 需要導入模塊: from pyglet import gl [as 別名]
# 或者: from pyglet.gl import glDisable [as 別名]
def show_drone(self, position, rotation):
        """
        Show the drone 3D model with corresponding translation and rotation.
        """
        # Get the transform matrix for drone 3D model
        x, z, y = position
        transform = np.eye(4)
        transform[:3, 3] = [x, y, z]

        # NOTE: change the view size of drone 3D model
        transform[0, 0] = 2.5
        transform[1, 1] = 2.5
        transform[2, 2] = 2.5

        # Match drone model space x-y-z to openGL x-z-y
        # TODO: read the config.json and match the propeller positions
        model_space_transform = rotation_transform_mat(-np.pi / 2, 'roll')
        transform = np.dot(transform, model_space_transform)

        yaw, pitch, roll = rotation
        if self.debug_mode:
            # NOTE: manually set values to debug rotation,
            # it's useful when input act is in form [c, c, c, c].
            yaw = np.pi / 2
            # pitch = np.pi / 2
            # roll = np.pi / 2
        transform = np.dot(transform, rotation_transform_mat(yaw, 'yaw'))
        transform = np.dot(transform, rotation_transform_mat(pitch, 'pitch'))
        transform = np.dot(transform, rotation_transform_mat(roll, 'roll'))

        # Add a new matrix to the model stack to transform the model
        gl.glPushMatrix()
        gl.glMultMatrixf(rendering.matrix_to_gl(transform))

        # Enable the target texture
        if self.drone_texture is not None:
            gl.glEnable(self.drone_texture.target)
            gl.glBindTexture(self.drone_texture.target, self.drone_texture.id)

        # Draw the mesh with its transform applied
        self.drone_drawer.draw(mode=self.drone_vertex_list_mode)
        gl.glPopMatrix()

        # Disable texture after using
        if self.drone_texture is not None:
            gl.glDisable(self.drone_texture.target) 
開發者ID:PaddlePaddle,項目名稱:RLSchool,代碼行數:48,代碼來源:render.py


注:本文中的pyglet.gl.glDisable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。