Python GL.glGenRenderbuffers方法代碼示例- 純淨天空
文章推薦指數: 80 %
本文整理匯總了Python中OpenGL.GL.glGenRenderbuffers方法的典型用法代碼示例。
如果您正苦於以下問題:Python GL.glGenRenderbuffers方法的具體用法?Python GL.
當前位置:首頁>>代碼示例>>Python>>正文
本文整理匯總了Python中OpenGL.GL.glGenRenderbuffers方法的典型用法代碼示例。
如果您正苦於以下問題:PythonGL.glGenRenderbuffers方法的具體用法?PythonGL.glGenRenderbuffers怎麽用?PythonGL.glGenRenderbuffers使用的例子?那麽恭喜您,這裏精選的方法代碼示例或許可以為您提供幫助。
您也可以進一步了解該方法所在類OpenGL.GL的用法示例。
在下文中一共展示了GL.glGenRenderbuffers方法的3個代碼示例,這些例子默認根據受歡迎程度排序。
您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於我們的係統推薦出更棒的Python代碼示例。
示例1:_init_framebuffer_object
點讚2
#需要導入模塊:fromOpenGLimportGL[as別名]
#或者:fromOpenGL.GLimportglGenRenderbuffers[as別名]
def_init_framebuffer_object(self):
"""
returnsaFramebufferObjecttosupportoffscreenrendering.
http://learnopengl.com/#!Advanced-OpenGL/Framebuffers
"""
fbo=gl.glGenFramebuffers(1)
gl.glBindFramebuffer(gl.GL_FRAMEBUFFER,fbo)
rbo=gl.glGenRenderbuffers(1)
gl.glBindRenderbuffer(gl.GL_RENDERBUFFER,rbo)
gl.glRenderbufferStorage(
gl.GL_RENDERBUFFER,
gl.GL_RGBA,
self.init_width,
self.init_height
)
gl.glFramebufferRenderbuffer(
gl.GL_FRAMEBUFFER,gl.GL_COLOR_ATTACHMENT0,gl.GL_RENDERBUFFER,rbo)
gl.glBindRenderbuffer(gl.GL_RENDERBUFFER,0)
gl.glBindFramebuffer(gl.GL_FRAMEBUFFER,0)
fbo_status=gl.glCheckFramebufferStatus(gl.GL_FRAMEBUFFER)
iffbo_status!=gl.GL_FRAMEBUFFER_COMPLETE:
gl.glDeleteFramebuffers([fbo])
glfw.terminate()
raiseException('Framebufferfailedstatuscheck:%s'%fbo_status)
self._fbo=fbo
self._rbo=rbo開發者ID:bstadie,項目名稱:third_person_im,代碼行數:31,代碼來源:mjviewer.py
示例2:setup_fb
點讚2
#需要導入模塊:fromOpenGLimportGL[as別名]
#或者:fromOpenGL.GLimportglGenRenderbuffers[as別名]
defsetup_fb(self,width,height):
'''SetsupFrameBufferthatwillbeusedascontainer
for1passofrendering'''
#CleanupoldFBandTexture
ifself.fb_textureisnotNoneand\
GL.glIsTexture(self.fb_texture):
GL.glDeleteTextures([self.fb_texture])
ifself.fboisnotNoneandGL.glIsFramebuffer(self.fbo):
GL.glDeleteFramebuffers(1,[self.fbo])
#initializeFrameBuffer
self.fbo=GL.glGenFramebuffers(1)
GL.glBindFramebuffer(GL.GL_FRAMEBUFFER,self.fbo)
depthbuffer=GL.glGenRenderbuffers(1)
GL.glBindRenderbuffer(GL.GL_RENDERBUFFER,depthbuffer)
GL.glRenderbufferStorage(GL.GL_RENDERBUFFER,GL.GL_DEPTH_COMPONENT32F,
width,height)
GL.glFramebufferRenderbuffer(
GL.GL_FRAMEBUFFER,GL.GL_DEPTH_ATTACHMENT,GL.GL_RENDERBUFFER,
depthbuffer
)
#endofFrameBufferinitialization
#generatethetexturewerenderto,andsetparameters
self.fb_texture=GL.glGenTextures(1)#createtargettexture
#bindtonewtexture,allfuturetexturefunctionswillmodifythis
#particularone
GL.glBindTexture(GL.GL_TEXTURE_2D,self.fb_texture)
#sethowourtexturebehavesonx,yboundaries
GL.glTexParameterf(GL.GL_TEXTURE_2D,GL.GL_TEXTURE_WRAP_S,GL.GL_REPEAT)
GL.glTexParameterf(GL.GL_TEXTURE_2D,GL.GL_TEXTURE_WRAP_T,GL.GL_REPEAT)
#sethowourtextureisfiltered
GL.glTexParameteri(GL.GL_TEXTURE_2D,GL.GL_TEXTURE_MAG_FILTER,GL.GL_LINEAR)
GL.glTexParameteri(GL.GL_TEXTURE_2D,GL.GL_TEXTURE_MIN_FILTER,GL.GL_LINEAR)
#occupywidthxheighttexturememory,(Noneattheend==empty
#image)
GL.glTexImage2D(GL.GL_TEXTURE_2D,0,GL.GL_RGBA32F,width,
height,0,GL.GL_RGBA,GL.GL_FLOAT,None)
#---endtextureinit
#Set"fb_texture"asourcolourattachment#0
GL.glFramebufferTexture2D(
GL.GL_FRAMEBUFFER,GL.GL_COLOR_ATTACHMENT0,GL.GL_TEXTURE_2D,
self.fb_texture,
0#mipmaplevel,normally0
)
#verifythateverythingwentwell
status=GL.glCheckFramebufferStatus(GL.GL_FRAMEBUFFER)
assertstatus==GL.GL_FRAMEBUFFER_COMPLETE,status開發者ID:yt-project,項目名稱:yt,代碼行數:56,代碼來源:interactive_vr.py
示例3:createDepthBuffer
點讚2
#需要導入模塊:fromOpenGLimportGL[as別名]
#或者:fromOpenGL.GLimportglGenRenderbuffers[as別名]
defcreateDepthBuffer(self,width,height):
textureId=(gl.GLuint*1)()
gl.glGenRenderbuffers(1,textureId)
gl.glBindRenderbuffer(gl.GL_RENDERBUFFER,textureId[0])
gl.glRenderbufferStorage(gl.GL_RENDERBUFFER,gl.GL_DEPTH_COMPONENT,width,height)
gl.glBindRenderbuffer(gl.GL_RENDERBUFFER,0)
returntextureId[0]開發者ID:bitsawer,項目名稱:renpy-shader,代碼行數:9,代碼來源:controller.py
注:本文中的OpenGL.GL.glGenRenderbuffers方法示例整理自Github/MSDocs等源碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。
相關方法
GL.glClear
GL.glEnable
GL.glClearColor
GL.GL_DEPTH_BUFFER_BIT
GL.glViewport
GL.GL_UNSIGNED_BYTE
GL.GL_FLOAT
GL.glEnd
GL.glBegin
GL.glBlendFunc
GL.GL_ONE_MINUS_SRC_ALPHA
GL.GL_RGB
GL.glDrawArrays
GL.glDisable
GL.glBindTexture
GL.glTexImage2D
GL.glGenTextures
GL.GL_TEXTURE_MIN_FILTER
GL.GL_TEXTURE_MAG_FILTER
GL.glPointSize
GL.GL_TEXTURE_2D
GL.GL_RGBA
GL.glMatrixMode
GL.glEnableClientState
GL.glLoadIdentity
GL.glColor3f
GL.glVertex3f
GL.GL_LINEAR
GL.glOrtho
GL.glReadPixels
GL.glLineWidth
GL.GL_DEPTH_COMPONENT
GL.glDisableClientState
GL.glNewList
GL.GL_COMPILE
GL.GL_UNSIGNED_INT
GL.GL_NEAREST
GL.glColor4f
GL.glDrawElements
GL.glEndList
GL.glTexParameteri
GL.GL_FALSE
GL.glCallList
GL.glGenLists
GL.glActiveTexture
GL.glPushMatrix
GL.glPopMatrix
GL.GL_COLOR_BUFFER_BIT
GL.glVertexAttribPointer
GL.GL_TEXTURE_WRAP_S
GL.GL_TEXTURE_WRAP_T
GL.glGetUniformLocation
GL.glUseProgram
GL.glGetString
GL.GL_VERTEX_SHADER
GL.glBindBuffer
GL.GL_FRAGMENT_SHADER
GL.glGenBuffers
GL.glBufferData
GL.glEnableVertexAttribArray
GL.glDeleteProgram
GL.glDeleteTextures
GL.glUniform1i
GL.GL_RGBA8
GL.glVertexPointerf
GL.glTranslate
GL.glDepthMask
延伸文章資訊
- 1Python GL.glGenRenderbuffers方法代碼示例- 純淨天空
本文整理匯總了Python中OpenGL.GL.glGenRenderbuffers方法的典型用法代碼示例。如果您正苦於以下問題:Python GL.glGenRenderbuffers方法的具...
- 2glGenRenderbuffers | Apple Developer Documentation
glGenRenderbuffers. No overview available. Availability. iOS 3.0–12.0 Deprecated ... Declaration....
- 3Java GLES20.glGenRenderbuffers方法代碼示例- 純淨天空
本文整理匯總了Java中android.opengl.GLES20.glGenRenderbuffers方法的典型用法代碼示例。如果您正苦於以下問題:Java GLES20.glGenRende...
- 4C++ (Cpp) glGenRenderbuffers Examples - HotExamples
C++ (Cpp) glGenRenderbuffers - 6 examples found. These are the top rated real world C++ (Cpp) exa...
- 5glGenRenderbuffers - generate renderbuffer object names
glGenRenderbuffers returns n renderbuffer object names in renderbuffers. There is no guarantee th...