本文整理汇总了Python中OpenGL.GL.GL_COLOR_BUFFER_BIT属性的典型用法代码示例。如果您正苦于以下问题:Python GL.GL_COLOR_BUFFER_BIT属性的具体用法?Python GL.GL_COLOR_BUFFER_BIT怎么用?Python GL.GL_COLOR_BUFFER_BIT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类OpenGL.GL
的用法示例。
在下文中一共展示了GL.GL_COLOR_BUFFER_BIT属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: display
# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import GL_COLOR_BUFFER_BIT [as 别名]
def display():
gl.glClear (gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT)
glut.glutSwapBuffers()
示例2: clear
# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import GL_COLOR_BUFFER_BIT [as 别名]
def clear(self):
if self.drawBackground:
GL.glClearColor(0.25, 0.27, 0.77, 1.0)
else:
GL.glClearColor(0.0, 0.0, 0.0, 0.0)
GL.glClear(GL.GL_DEPTH_BUFFER_BIT | GL.GL_COLOR_BUFFER_BIT)
示例3: render_stereo_targets
# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import GL_COLOR_BUFFER_BIT [as 别名]
def render_stereo_targets(self):
GL.glClearColor(0, 0, 0, 1)
GL.glEnable(GL.GL_MULTISAMPLE)
# Left Eye
GL.glBindFramebuffer(GL.GL_FRAMEBUFFER, self.left_eye_desc.render_framebuffer_id)
GL.glViewport(0, 0, self.render_width, self.render_height)
self.render_scene(openvr.Eye_Left)
GL.glBindFramebuffer(GL.GL_FRAMEBUFFER, 0)
GL.glDisable(GL.GL_MULTISAMPLE)
GL.glBindFramebuffer(GL.GL_READ_FRAMEBUFFER, self.left_eye_desc.render_framebuffer_id)
GL.glBindFramebuffer(GL.GL_DRAW_FRAMEBUFFER, self.left_eye_desc.resolve_framebuffer_id)
GL.glBlitFramebuffer(
0, 0, self.render_width, self.render_height,
0, 0, self.render_width, self.render_height,
GL.GL_COLOR_BUFFER_BIT, GL.GL_LINEAR)
GL.glBindFramebuffer(GL.GL_READ_FRAMEBUFFER, 0)
GL.glBindFramebuffer(GL.GL_DRAW_FRAMEBUFFER, 0)
# Right Eye
GL.glEnable(GL.GL_MULTISAMPLE)
GL.glBindFramebuffer(GL.GL_FRAMEBUFFER, self.right_eye_desc.render_framebuffer_id)
GL.glViewport(0, 0, self.render_width, self.render_height)
self.render_scene(openvr.Eye_Right)
GL.glBindFramebuffer(GL.GL_FRAMEBUFFER, 0)
GL.glDisable(GL.GL_MULTISAMPLE)
GL.glBindFramebuffer(GL.GL_READ_FRAMEBUFFER, self.right_eye_desc.render_framebuffer_id)
GL.glBindFramebuffer(GL.GL_DRAW_FRAMEBUFFER, self.right_eye_desc.resolve_framebuffer_id)
GL.glBlitFramebuffer(
0, 0, self.render_width, self.render_height,
0, 0, self.render_width, self.render_height,
GL.GL_COLOR_BUFFER_BIT, GL.GL_LINEAR)
GL.glBindFramebuffer(GL.GL_READ_FRAMEBUFFER, 0)
GL.glBindFramebuffer(GL.GL_DRAW_FRAMEBUFFER, 0)
示例4: render_scene
# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import GL_COLOR_BUFFER_BIT [as 别名]
def render_scene(self, eye):
GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT)
GL.glEnable(GL.GL_DEPTH_TEST)
if self.show_cubes:
GL.glUseProgram(self.scene_program)
GL.glUniformMatrix4fv(
self.scene_matrix_location, 1, False,
self.get_current_view_projection_matrix(eye))
GL.glBindVertexArray(self.scene_vao)
GL.glBindTexture(GL.GL_TEXTURE_2D, self.i_texture)
GL.glDrawArrays(GL.GL_TRIANGLES, 0, int(self.vert_count))
GL.glBindVertexArray(0)
b_is_input_available = self.hmd.isInputAvailable()
if b_is_input_available:
# draw the controller axis lines
GL.glUseProgram(self.controller_transform_program)
GL.glUniformMatrix4fv(self.controller_matrix_location, 1, False, self.get_current_view_projection_matrix(eye))
GL.glBindVertexArray(self.controller_vao)
GL.glDrawArrays(GL.GL_LINES, 0, self.controller_vertex_count)
GL.glBindVertexArray(0)
# ----- Render Model rendering -----
GL.glUseProgram(self.render_model_program)
for hand in self.hand:
if not hand.show_controller:
continue
if hand.render_model is None:
continue
mvp = hand.pose @ self.get_current_view_projection_matrix(eye)
GL.glUniformMatrix4fv(self.render_model_matrix_location, 1, False, mvp)
hand.render_model.draw()
GL.glUseProgram(0)
示例5: run_main_loop
# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import GL_COLOR_BUFFER_BIT [as 别名]
def run_main_loop(self):
while not glfw.window_should_close(self.window):
self.handle_input()
self.render_frame()
glfw.swap_buffers(self.window)
GL.glClearColor(0, 0, 0, 1)
GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT)
glfw.poll_events()
示例6: __init__
# 需要导入模块: from OpenGL import GL [as 别名]
# 或者: from OpenGL.GL import GL_COLOR_BUFFER_BIT [as 别名]
def __init__(self, width, height, drawFunc):
tex = GL.glGenTextures(1)
GL.glBindTexture(GL.GL_TEXTURE_2D, tex)
GL.glTexParameter(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST)
GL.glTexParameter(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST)
GL.glTexImage2D(GL.GL_TEXTURE_2D, 0, GL.GL_RGBA8, width, height, 0, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, None)
self.enabled = False
self._texID = tex
if bool(FBO.glGenFramebuffers) and "Intel" not in GL.glGetString(GL.GL_VENDOR):
buf = FBO.glGenFramebuffers(1)
depthbuffer = FBO.glGenRenderbuffers(1)
FBO.glBindFramebuffer(FBO.GL_FRAMEBUFFER, buf)
FBO.glBindRenderbuffer(FBO.GL_RENDERBUFFER, depthbuffer)
FBO.glRenderbufferStorage(FBO.GL_RENDERBUFFER, GL.GL_DEPTH_COMPONENT, width, height)
FBO.glFramebufferRenderbuffer(FBO.GL_FRAMEBUFFER, FBO.GL_DEPTH_ATTACHMENT, FBO.GL_RENDERBUFFER, depthbuffer)
FBO.glFramebufferTexture2D(FBO.GL_FRAMEBUFFER, FBO.GL_COLOR_ATTACHMENT0, GL.GL_TEXTURE_2D, tex, 0)
status = FBO.glCheckFramebufferStatus(FBO.GL_FRAMEBUFFER)
if status != FBO.GL_FRAMEBUFFER_COMPLETE:
print "glCheckFramebufferStatus", status
self.enabled = False
return
FBO.glBindFramebuffer(FBO.GL_FRAMEBUFFER, buf)
with gl.glPushAttrib(GL.GL_VIEWPORT_BIT):
GL.glViewport(0, 0, width, height)
drawFunc()
FBO.glBindFramebuffer(FBO.GL_FRAMEBUFFER, 0)
FBO.glDeleteFramebuffers(1, [buf])
FBO.glDeleteRenderbuffers(1, [depthbuffer])
self.enabled = True
else:
GL.glReadBuffer(GL.GL_BACK)
GL.glPushAttrib(
GL.GL_VIEWPORT_BIT | GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT | GL.GL_STENCIL_TEST | GL.GL_STENCIL_BUFFER_BIT)
GL.glDisable(GL.GL_STENCIL_TEST)
GL.glViewport(0, 0, width, height)
GL.glScissor(0, 0, width, height)
with gl.glEnable(GL.GL_SCISSOR_TEST):
drawFunc()
GL.glBindTexture(GL.GL_TEXTURE_2D, tex)
GL.glReadBuffer(GL.GL_BACK)
GL.glCopyTexSubImage2D(GL.GL_TEXTURE_2D, 0, 0, 0, 0, 0, width, height)
GL.glPopAttrib()