Python GL.glCheckFramebufferStatus方法代碼示例- 純淨天空

文章推薦指數: 80 %
投票人數:10人

本文整理匯總了Python中OpenGL.GL.glCheckFramebufferStatus方法的典型用法代碼示例。

如果您正苦於以下問題:Python GL.glCheckFramebufferStatus方法的具體用法? 當前位置:首頁>>代碼示例>>Python>>正文 本文整理匯總了Python中OpenGL.GL.glCheckFramebufferStatus方法的典型用法代碼示例。

如果您正苦於以下問題:PythonGL.glCheckFramebufferStatus方法的具體用法?PythonGL.glCheckFramebufferStatus怎麽用?PythonGL.glCheckFramebufferStatus使用的例子?那麽恭喜您,這裏精選的方法代碼示例或許可以為您提供幫助。

您也可以進一步了解該方法所在類OpenGL.GL的用法示例。

在下文中一共展示了GL.glCheckFramebufferStatus方法的5個代碼示例,這些例子默認根據受歡迎程度排序。

您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於我們的係統推薦出更棒的Python代碼示例。

示例1:__init__ ​點讚3 ​ #需要導入模塊:fromOpenGLimportGL[as別名] #或者:fromOpenGL.GLimportglCheckFramebufferStatus[as別名] def__init__(self): self.depthMapFbo=gl.glGenFramebuffers(1) self.shadowW_i=1024*4 self.shadowH_i=1024*4 self.program=self._getProgram() self.depthMapTex=gl.glGenTextures(1) gl.glBindTexture(gl.GL_TEXTURE_2D,self.depthMapTex) gl.glTexImage2D(gl.GL_TEXTURE_2D,0,gl.GL_DEPTH_COMPONENT,self.shadowW_i,self.shadowH_i,0,gl.GL_DEPTH_COMPONENT,gl.GL_FLOAT,None) gl.glTexParameteri(gl.GL_TEXTURE_2D,gl.GL_TEXTURE_MIN_FILTER,gl.GL_NEAREST) gl.glTexParameteri(gl.GL_TEXTURE_2D,gl.GL_TEXTURE_MAG_FILTER,gl.GL_NEAREST) gl.glTexParameteri(gl.GL_TEXTURE_2D,gl.GL_TEXTURE_WRAP_S,gl.GL_CLAMP_TO_BORDER) gl.glTexParameteri(gl.GL_TEXTURE_2D,gl.GL_TEXTURE_WRAP_T,gl.GL_CLAMP_TO_BORDER) #gl.glTexParameterfv(gl.GL_TEXTURE_2D,gl.GL_TEXTURE_BORDER_COLOR,(1.0,1.0,1.0,1.0)) gl.glBindFramebuffer(gl.GL_FRAMEBUFFER,self.depthMapFbo) gl.glFramebufferTexture2D(gl.GL_FRAMEBUFFER,gl.GL_DEPTH_ATTACHMENT,gl.GL_TEXTURE_2D,self.depthMapTex,0) gl.glDrawBuffer(gl.GL_NONE) gl.glReadBuffer(gl.GL_NONE) ifgl.glCheckFramebufferStatus(gl.GL_FRAMEBUFFER)!=gl.GL_FRAMEBUFFER_COMPLETE: print("ERROR::FRAMEBUFFER::Framebufferisnotcomplete!") gl.glBindFramebuffer(gl.GL_FRAMEBUFFER,0)開發者ID:SausageTaste,項目名稱:practiceOpenGL-FirstPerson,代碼行數:28,代碼來源:main_v2.py 示例2:genShadowMap ​點讚3 ​ #需要導入模塊:fromOpenGLimportGL[as別名] #或者:fromOpenGL.GLimportglCheckFramebufferStatus[as別名] defgenShadowMap(self)->None: self.__depthMapFbo=gl.glGenFramebuffers(1); self.depthMapTex=gl.glGenTextures(1); gl.glBindTexture(gl.GL_TEXTURE_2D,self.depthMapTex); gl.glTexImage2D(gl.GL_TEXTURE_2D,0,gl.GL_DEPTH_COMPONENT,self.__shadowW_i,self.__shadowH_i,0, gl.GL_DEPTH_COMPONENT,gl.GL_FLOAT,None); gl.glTexParameteri(gl.GL_TEXTURE_2D,gl.GL_TEXTURE_MIN_FILTER,gl.GL_NEAREST); gl.glTexParameteri(gl.GL_TEXTURE_2D,gl.GL_TEXTURE_MAG_FILTER,gl.GL_NEAREST); gl.glTexParameteri(gl.GL_TEXTURE_2D,gl.GL_TEXTURE_WRAP_S,gl.GL_CLAMP_TO_BORDER); gl.glTexParameteri(gl.GL_TEXTURE_2D,gl.GL_TEXTURE_WRAP_T,gl.GL_CLAMP_TO_BORDER); #gl.glTexParameterfv(gl.GL_TEXTURE_2D,gl.GL_TEXTURE_BORDER_COLOR,(1.0,1.0,1.0,1.0)); gl.glBindFramebuffer(gl.GL_FRAMEBUFFER,self.__depthMapFbo); gl.glFramebufferTexture2D(gl.GL_FRAMEBUFFER,gl.GL_DEPTH_ATTACHMENT,gl.GL_TEXTURE_2D,self.depthMapTex,0); gl.glDrawBuffer(gl.GL_NONE); gl.glReadBuffer(gl.GL_NONE); ifgl.glCheckFramebufferStatus(gl.GL_FRAMEBUFFER)!=gl.GL_FRAMEBUFFER_COMPLETE: print("ERROR::FRAMEBUFFER::Framebufferisnotcomplete!"); gl.glBindFramebuffer(gl.GL_FRAMEBUFFER,0);開發者ID:SausageTaste,項目名稱:escapeRoom,代碼行數:24,代碼來源:light.py 示例3:check_status ​點讚3 ​ #需要導入模塊:fromOpenGLimportGL[as別名] #或者:fromOpenGL.GLimportglCheckFramebufferStatus[as別名] defcheck_status(self): """ ChecksthecompletenessoftheFBO """ status=GL.glCheckFramebufferStatus(GL.GL_FRAMEBUFFER) incomplete_states={ GL.GL_FRAMEBUFFER_UNSUPPORTED:"Framebufferunsupported.Tryanotherformat.", GL.GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:"Framebufferincompleteattachment", GL.GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:"Framebuffermissingattachment", GL.GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS:"Framebufferunsupporteddimension.", GL.GL_FRAMEBUFFER_INCOMPLETE_FORMATS:"Framebufferincopleteformats.", GL.GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER:"Framebufferincompletedrawbuffer.", GL.GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER:"Framebufferincompletereadbuffer", } ifstatus==GL.GL_FRAMEBUFFER_COMPLETE: return s=incomplete_states.get(status,"Unknownerror") raiseFBOError(s)開發者ID:Contraz,項目名稱:demosys-py,代碼行數:20,代碼來源:fbo.py 示例4:_init_framebuffer_object ​點讚2 ​ #需要導入模塊:fromOpenGLimportGL[as別名] #或者:fromOpenGL.GLimportglCheckFramebufferStatus[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 示例5:setup_fb ​點讚2 ​ #需要導入模塊:fromOpenGLimportGL[as別名] #或者:fromOpenGL.GLimportglCheckFramebufferStatus[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 注:本文中的OpenGL.GL.glCheckFramebufferStatus方法示例整理自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



請為這篇文章評分?