当前位置: 首页>>代码示例>>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;未经允许,请勿转载。