本文整理汇总了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
示例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
示例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)
示例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)
示例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)
示例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)
示例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
示例8: _gl_set_background
# 需要导入模块: from pyglet import gl [as 别名]
# 或者: from pyglet.gl import glClearColor [as 别名]
def _gl_set_background(background):
gl.glClearColor(*background)
示例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])
示例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())
示例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()
示例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()
示例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
示例14: clear
# 需要导入模块: from pyglet import gl [as 别名]
# 或者: from pyglet.gl import glClearColor [as 别名]
def clear(self):
gl.glClearColor(*self.clear_color)
self.window.clear()
示例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()