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


Python gl.glClearColor方法代码示例

本文整理汇总了Python中pyglet.gl.glClearColor方法的典型用法代码示例。如果您正苦于以下问题:Python gl.glClearColor方法的具体用法?Python gl.glClearColor怎么用?Python gl.glClearColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyglet.gl的用法示例。


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

示例1: on_draw

# 需要导入模块: from pyglet import gl [as 别名]
# 或者: from pyglet.gl import glClearColor [as 别名]
def on_draw(self):
        gl.glClearColor(0, 0, 0, 0)
        self.clear()
        gl.glViewport(0, 0, self.width, self.height)
        now = time.clock() - self._start_time
        now *= self._speed
        with self.bufferA:
            with self.shaderA:
                self.shaderA.uniformf("iTime", now)
                self.shaderA.uniformi("iFrame", self._frame_count)
                gl.glDrawArrays(gl.GL_TRIANGLE_STRIP, 0, 4)

        with self.bufferB:
            with self.shaderB:
                self.shaderB.uniformf("iTime", now)
                gl.glDrawArrays(gl.GL_TRIANGLE_STRIP, 0, 4)

        with self.shaderC:
            self.shaderC.uniformf("iTime", now)
            gl.glDrawArrays(gl.GL_TRIANGLE_STRIP, 0, 4)

        self._frame_count += 1 
开发者ID:neozhaoliang,项目名称:pywonderland,代码行数:24,代码来源:example_wythoff_shader_animation.py

示例2: on_draw

# 需要导入模块: from pyglet import gl [as 别名]
# 或者: from pyglet.gl import glClearColor [as 别名]
def on_draw(self):
        gl.glClearColor(0, 0, 0, 0)
        self.clear()
        gl.glViewport(0, 0, self.width, self.height)
        self._last = self._now
        self._now = time.clock()
        itime = self._now - self._start_time
        idate = get_idate()
        delta = self._now - self._last
        with self.bufferA:
            with self.shaderA:
                self.shaderA.uniformf("iTime", itime)
                self.shaderA.uniformf("iDate", *idate)
                self.shaderA.uniformf("iTimeDelta", delta)
                gl.glDrawArrays(gl.GL_TRIANGLE_STRIP, 0, 4)

        with self.shaderB:
            self.shaderB.uniformf("iTime", itime)
            self.shaderB.uniformf("iDate", *idate)
            self.shaderB.uniformf("iTimeDelta", delta)
            gl.glDrawArrays(gl.GL_TRIANGLE_STRIP, 0, 4)

        self._frame_count += 1 
开发者ID:neozhaoliang,项目名称:pywonderland,代码行数:25,代码来源:example_wythoff_shader_animation.py

示例3: text_window

# 需要导入模块: from pyglet import gl [as 别名]
# 或者: from pyglet.gl import glClearColor [as 别名]
def text_window(request):
    class _TestWindow(window.Window):
        def __init__(self, doctype, *args, **kwargs):
            super(_TestWindow, self).__init__(*args, **kwargs)

            self.batch = graphics.Batch()
            self.document = doctype()
            self.layout = layout.IncrementalTextLayout(self.document,
                self.width, self.height, batch=self.batch)

        def on_draw(self):
            gl.glClearColor(1, 1, 1, 1)
            self.clear()
            self.batch.draw()

        def set_bold(self):
            self.document.set_style(0, len(self.document.text), {"bold": True})

    return _TestWindow(request.param) 
开发者ID:pyglet,项目名称:pyglet,代码行数:21,代码来源:test_empty_document.py

示例4: clear_color

# 需要导入模块: from pyglet import gl [as 别名]
# 或者: from pyglet.gl import glClearColor [as 别名]
def clear_color(r, g, b):
    pyglet_gl.glClearColor(r, g, b, 1.)
    pyglet_gl.glClear(pyglet_gl.GL_COLOR_BUFFER_BIT | pyglet_gl.GL_DEPTH_BUFFER_BIT) 
开发者ID:ratcave,项目名称:ratcave,代码行数:5,代码来源:gl.py

示例5: on_draw

# 需要导入模块: from pyglet import gl [as 别名]
# 或者: from pyglet.gl import glClearColor [as 别名]
def on_draw(self):
        gl.glClearColor(0, 0, 0, 0)
        self.clear()
        gl.glViewport(0, 0, self.width, self.height)
        with self.shader:
            self.shader.uniformf("iTime", time.clock() - self._start_time)
            gl.glDrawArrays(gl.GL_TRIANGLE_STRIP, 0, 4) 
开发者ID:neozhaoliang,项目名称:pywonderland,代码行数:9,代码来源:fractal3d.py

示例6: on_draw

# 需要导入模块: from pyglet import gl [as 别名]
# 或者: from pyglet.gl import glClearColor [as 别名]
def on_draw(self):
        gl.glClearColor(0, 0, 0, 0)
        self.clear()
        gl.glViewport(0, 0, self.width, self.height)
        now = time.clock() - self._start_time
        now *= 20
        with self.shader:
            self.shader.uniformf("iTime", now)
            gl.glDrawArrays(gl.GL_TRIANGLE_STRIP, 0, 4) 
开发者ID:neozhaoliang,项目名称:pywonderland,代码行数:11,代码来源:loxodrome.py

示例7: on_draw

# 需要导入模块: from pyglet import gl [as 别名]
# 或者: from pyglet.gl import glClearColor [as 别名]
def on_draw(self):
        gl.glClearColor(0, 0, 0, 0)
        self.clear()
        gl.glViewport(0, 0, self.width, self.height)
        with self.shader:
            self.shader.uniformf("iTime", time.clock() - self._start_time)
            gl.glDrawArrays(gl.GL_TRIANGLE_STRIP, 0, 4)

        if self.video_on and (self.frame_count % self.sample_rate == 0):
            self.write_video_frame()

        self.frame_count += 1 
开发者ID:neozhaoliang,项目名称:pywonderland,代码行数:14,代码来源:Mobius_in_H3space.py

示例8: _gl_set_background

# 需要导入模块: from pyglet import gl [as 别名]
# 或者: from pyglet.gl import glClearColor [as 别名]
def _gl_set_background(background):
        gl.glClearColor(*background) 
开发者ID:PaddlePaddle,项目名称:RLSchool,代码行数:4,代码来源:render.py

示例9: _gl_unset_background

# 需要导入模块: from pyglet import gl [as 别名]
# 或者: from pyglet.gl import glClearColor [as 别名]
def _gl_unset_background():
        gl.glClearColor(*[0, 0, 0, 0]) 
开发者ID:PaddlePaddle,项目名称:RLSchool,代码行数:4,代码来源:render.py

示例10: draw

# 需要导入模块: from pyglet import gl [as 别名]
# 或者: from pyglet.gl import glClearColor [as 别名]
def draw(self, *args, **kwargs):
        imgui.new_frame()

        if imgui.begin_main_menu_bar():
            if imgui.begin_menu("File", True):

                clicked_quit, selected_quit = imgui.menu_item(
                    "Quit", 'Cmd+Q', False, True
                )

                if clicked_quit:
                    exit(1)

                imgui.end_menu()
            imgui.end_main_menu_bar()

        imgui.show_test_window()

        imgui.begin("Custom window", True)
        imgui.text("Bar")
        imgui.text_colored("Eggs", 0.2, 1., 0.)
        imgui.end()

        gl.glClearColor(1., 1., 1., 1)
        gl.glClear(gl.GL_COLOR_BUFFER_BIT)

        imgui.render()
        self.renderer.render(imgui.get_draw_data()) 
开发者ID:swistakm,项目名称:pyimgui,代码行数:30,代码来源:integrations_cocos2d.py

示例11: main

# 需要导入模块: from pyglet import gl [as 别名]
# 或者: from pyglet.gl import glClearColor [as 别名]
def main():

    window = pyglet.window.Window(width=1280, height=720, resizable=True)
    gl.glClearColor(1, 1, 1, 1)
    imgui.create_context()
    impl = PygletRenderer(window)

    def update(dt):
        imgui.new_frame()
        if imgui.begin_main_menu_bar():
            if imgui.begin_menu("File", True):

                clicked_quit, selected_quit = imgui.menu_item(
                    "Quit", 'Cmd+Q', False, True
                )

                if clicked_quit:
                    exit(1)

                imgui.end_menu()
            imgui.end_main_menu_bar()

        imgui.show_test_window()

        imgui.begin("Custom window", True)
        imgui.text("Bar")
        imgui.text_colored("Eggs", 0.2, 1., 0.)
        imgui.end()

    @window.event
    def on_draw():
        update(1/60.0)
        window.clear()
        imgui.render()
        impl.render(imgui.get_draw_data())

    pyglet.app.run()
    impl.shutdown() 
开发者ID:swistakm,项目名称:pyimgui,代码行数:40,代码来源:integrations_pyglet.py

示例12: on_draw

# 需要导入模块: from pyglet import gl [as 别名]
# 或者: from pyglet.gl import glClearColor [as 别名]
def on_draw(self):
        gl.glClearColor(1, 1, 1, 1)
        self.clear()
        self.batch.draw() 
开发者ID:shrimpboyho,项目名称:flappy-bird-py,代码行数:6,代码来源:CONTENT_VALIGN_CENTER.py

示例13: on_draw

# 需要导入模块: from pyglet import gl [as 别名]
# 或者: from pyglet.gl import glClearColor [as 别名]
def on_draw():
    gl.glClearColor(0.3, 0.3, 0.4, 1.0)
    window.clear()
    batch.draw()
    window.invalid = False 
开发者ID:pyglet,项目名称:pyglet,代码行数:7,代码来源:show_input.py

示例14: clear

# 需要导入模块: from pyglet import gl [as 别名]
# 或者: from pyglet.gl import glClearColor [as 别名]
def clear(self):
        gl.glClearColor(*self.clear_color)
        self.window.clear() 
开发者ID:pyglet,项目名称:pyglet,代码行数:5,代码来源:event_loop.py

示例15: _draw

# 需要导入模块: from pyglet import gl [as 别名]
# 或者: from pyglet.gl import glClearColor [as 别名]
def _draw(self):
        gl.glClearColor(0.5, 0, 0, 1)
        gl.glClear(gl.GL_COLOR_BUFFER_BIT)
        gl.glLoadIdentity()
        self.label.draw()
        self.window.flip() 
开发者ID:pyglet,项目名称:pyglet,代码行数:8,代码来源:test_window_events.py


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