android.opengl.GLES20.glRenderbufferStorage java code ...
文章推薦指數: 80 %
public void glRenderbufferStorageEXT(int param1, int param2, int param3, int param4) { GLES20.glRenderbufferStorage(param1, param2, param3, param4); HowtouseglRenderbufferStoragemethodinandroid.opengl.GLES20BestJavacodesnippetsusingandroid.opengl.GLES20.glRenderbufferStorage(Showingtop20resultsoutof315)publicvoidglRenderbufferStorageEXT(intparam1,intparam2,intparam3,intparam4){ GLES20.glRenderbufferStorage(param1,param2,param3,param4); } publicRenderBuffer(intwidth,intheight,intactiveTexUnit){ this.width=width; this.height=height; this.activeTexUnit=activeTexUnit; int[]genbuf=newint[1]; //Generateandbind2dtexture GLES20.glActiveTexture(activeTexUnit); texId=MyGLUtils.genTexture(); IntBuffertexBuffer= ByteBuffer.allocateDirect(width*height*4).order(ByteOrder.nativeOrder()).asIntBuffer(); GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D,0,GLES20.GL_RGBA,width,height,0,GLES20.GL_RGBA,GLES20.GL_UNSIGNED_BYTE,texBuffer); GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,GL10.GL_TEXTURE_MIN_FILTER,GL10.GL_LINEAR); GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,GL10.GL_TEXTURE_MAG_FILTER,GL10.GL_LINEAR); GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D,GL10.GL_TEXTURE_WRAP_S,GL10.GL_CLAMP_TO_EDGE); GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D,GL10.GL_TEXTURE_WRAP_T,GL10.GL_CLAMP_TO_EDGE); //Generateframebuffer GLES20.glGenFramebuffers(1,genbuf,0); frameBufferId=genbuf[0]; //Bindframebuffer GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER,frameBufferId); //Generaterenderbuffer GLES20.glGenRenderbuffers(1,genbuf,0); renderBufferId=genbuf[0]; //Bindrenderbuffer GLES20.glBindRenderbuffer(GLES20.GL_RENDERBUFFER,renderBufferId); GLES20.glRenderbufferStorage(GLES20.GL_RENDERBUFFER,GLES20.GL_DEPTH_COMPONENT16,width,height); unbind(); } GLES20.glRenderbufferStorage(GLES20.GL_RENDERBUFFER,GLES20.GL_DEPTH_COMPONENT16,mWidth,mHeight); GLES20.glFramebufferRenderbuffer(GLES20.GL_FRAMEBUFFER,GLES20.GL_DEPTH_ATTACHMENT,GLES20.GL_RENDERBUFFER,bufferHandles[0]); GLES20.glRenderbufferStorage(GLES20.GL_RENDERBUFFER, GLES20.GL_DEPTH_COMPONENT16,mWidth,mHeight); publicvoidcreateEnvi(){ GLES20.glGenFramebuffers(1,fFrame,0); GLES20.glGenRenderbuffers(1,fRender,0); GLES20.glBindRenderbuffer(GLES20.GL_RENDERBUFFER,fRender[0]); GLES20.glRenderbufferStorage(GLES20.GL_RENDERBUFFER,GLES20.GL_DEPTH_COMPONENT16, mBitmap.getWidth(),mBitmap.getHeight()); GLES20.glFramebufferRenderbuffer(GLES20.GL_FRAMEBUFFER,GLES20.GL_DEPTH_ATTACHMENT, GLES20.GL_RENDERBUFFER,fRender[0]); GLES20.glBindRenderbuffer(GLES20.GL_RENDERBUFFER,0); GLES20.glGenTextures(2,fTexture,0); for(inti=0;i<2;i++){ GLES20.glBindTexture(GLES20.GL_TEXTURE_2D,fTexture[i]); if(i==0){ GLUtils.texImage2D(GLES20.GL_TEXTURE_2D,0,GLES20.GL_RGBA,mBitmap,0); }else{ GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D,0,GLES20.GL_RGBA,mBitmap.getWidth(),mBitmap.getHeight(), 0,GLES20.GL_RGBA,GLES20.GL_UNSIGNED_BYTE,null); } GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,GLES20.GL_TEXTURE_MIN_FILTER,GLES20.GL_NEAREST); GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,GLES20.GL_TEXTURE_MAG_FILTER,GLES20.GL_LINEAR); GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,GLES20.GL_TEXTURE_WRAP_S,GLES20.GL_CLAMP_TO_EDGE); GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,GLES20.GL_TEXTURE_WRAP_T,GLES20.GL_CLAMP_TO_EDGE); } mBuffer=ByteBuffer.allocate(mBitmap.getWidth()*mBitmap.getHeight()*4); } publicvoidstorage(intformat,intwidth,intheight){ GLES20.glRenderbufferStorage(GLES20.GL_RENDERBUFFER,format,width,height); } } @Override publicvoidglRenderbufferStorage(inttarget,intinternalformat,intwidth,intheight){ GLES20.glRenderbufferStorage(target,internalformat,width,height); } @Override publicvoidglRenderbufferStorage(inttarget,intinternalformat,intwidth,intheight){ GLES20.glRenderbufferStorage(target,internalformat,width,height); } publicvoidstorage(intformat,intwidth,intheight){ GLES20.glRenderbufferStorage(GLES20.GL_RENDERBUFFER,format,width,height); } } @Override publicvoidrenderbufferStorage(inttarget,intinternalFormat,intwidth,intheight){ GLES20.glRenderbufferStorage(target,internalFormat,width,height); } @Override publicvoidglRenderbufferStorage(inttarget,intinternalformat,intwidth,intheight){ GLES20.glRenderbufferStorage(target,internalformat,width,height); } privatebooleancreateFrameBuffer(){ GLES20.glGenFramebuffers(1,fFrame,0); GLES20.glGenRenderbuffers(1,fRender,0); genTextures(); GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER,fFrame[0]); GLES20.glBindRenderbuffer(GLES20.GL_RENDERBUFFER,fRender[0]); GLES20.glRenderbufferStorage(GLES20.GL_RENDERBUFFER,GLES20.GL_DEPTH_COMPONENT16,width, height); GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER,GLES20.GL_COLOR_ATTACHMENT0, GLES20.GL_TEXTURE_2D,fTexture[0],0); GLES20.glFramebufferRenderbuffer(GLES20.GL_FRAMEBUFFER,GLES20.GL_DEPTH_ATTACHMENT, GLES20.GL_RENDERBUFFER,fRender[0]); //intstatus=GLES20.glCheckFramebufferStatus(GLES20.GL_FRAMEBUFFER); //if(status==GLES20.GL_FRAMEBUFFER_COMPLETE){ //returntrue; //} unBindFrame(); returnfalse; } publicRenderBuffer(intwidth,intheight,intactiveTexUnit){ this.width=width; this.height=height; this.activeTexUnit=activeTexUnit; int[]genbuf=newint[1]; //Generateandbind2dtexture GLES20.glActiveTexture(activeTexUnit); texId=MyGLUtils.genTexture(); IntBuffertexBuffer= ByteBuffer.allocateDirect(width*height*4).order(ByteOrder.nativeOrder()).asIntBuffer(); GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D,0,GLES20.GL_RGBA,width,height,0,GLES20.GL_RGBA,GLES20.GL_UNSIGNED_BYTE,texBuffer); GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,GL10.GL_TEXTURE_MIN_FILTER,GL10.GL_LINEAR); GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,GL10.GL_TEXTURE_MAG_FILTER,GL10.GL_LINEAR); GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D,GL10.GL_TEXTURE_WRAP_S,GL10.GL_CLAMP_TO_EDGE); GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D,GL10.GL_TEXTURE_WRAP_T,GL10.GL_CLAMP_TO_EDGE); //Generateframebuffer GLES20.glGenFramebuffers(1,genbuf,0); frameBufferId=genbuf[0]; //Bindframebuffer GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER,frameBufferId); //Generaterenderbuffer GLES20.glGenRenderbuffers(1,genbuf,0); renderBufferId=genbuf[0]; //Bindrenderbuffer GLES20.glBindRenderbuffer(GLES20.GL_RENDERBUFFER,renderBufferId); GLES20.glRenderbufferStorage(GLES20.GL_RENDERBUFFER,GLES20.GL_DEPTH_COMPONENT16,width,height); unbind(); } privatebooleancreateFrameBuffer(){ GLES20.glGenFramebuffers(1,fFrame,0); GLES20.glGenRenderbuffers(1,fRender,0); genTextures(); GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER,fFrame[0]); GLES20.glBindRenderbuffer(GLES20.GL_RENDERBUFFER,fRender[0]); GLES20.glRenderbufferStorage(GLES20.GL_RENDERBUFFER,GLES20.GL_DEPTH_COMPONENT16,width, height); GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER,GLES20.GL_COLOR_ATTACHMENT0, GLES20.GL_TEXTURE_2D,fTexture[0],0); GLES20.glFramebufferRenderbuffer(GLES20.GL_FRAMEBUFFER,GLES20.GL_DEPTH_ATTACHMENT, GLES20.GL_RENDERBUFFER,fRender[0]); unBindFrame(); returnfalse; } @Override protectedvoidonSizeChanged(intwidth,intheight){ if(this.width!=width&&this.height!=height){ this.width=width; this.height=height; mFilter.setSize(width,height); deleteFrameBuffer(); GLES20.glGenFramebuffers(1,fFrame,0); GLES20.glGenRenderbuffers(1,fRender,0); GLES20.glBindRenderbuffer(GLES20.GL_RENDERBUFFER,fRender[0]); GLES20.glRenderbufferStorage(GLES20.GL_RENDERBUFFER,GLES20.GL_DEPTH_COMPONENT16, width,height); GLES20.glFramebufferRenderbuffer(GLES20.GL_FRAMEBUFFER,GLES20.GL_DEPTH_ATTACHMENT, GLES20.GL_RENDERBUFFER,fRender[0]); GLES20.glBindRenderbuffer(GLES20.GL_RENDERBUFFER,0); EasyGlUtils.genTexturesWithParameter(1,fTexture,0,GLES20.GL_RGBA,width,height); } } privatevoiddeleteFrameBuffer(){ GLES20.glBindRenderbuffer(GLES20.GL_RENDERBUFFER,mDepthBufferObj); GLES20.glRenderbufferStorage(GLES20.GL_RENDERBUFFER, GLES20.GL_DEPTH_COMPONENT16,mTexWidth,mTexHeight); renderBufferName=args[0]; GLES20.glBindRenderbuffer(GL_RENDERBUFFER,renderBufferName); GLES20.glRenderbufferStorage(GL_RENDERBUFFER,GL_DEPTH_COMPONENT16,width,height); GLES20.glFramebufferRenderbuffer(GL_FRAMEBUFFER,GL_DEPTH_ATTACHMENT,GL_RENDERBUFFER,renderBufferName); GLES20.glRenderbufferStorage(GLES20.GL_RENDERBUFFER,GLES20.GL_DEPTH_COMPONENT16,width, height); GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER,fboId[0]); GLES20.glRenderbufferStorage(GLES20.GL_RENDERBUFFER,GLES20.GL_DEPTH_COMPONENT16,mWidth,mHeight); GLES20.glFramebufferRenderbuffer(GLES20.GL_FRAMEBUFFER,GLES20.GL_DEPTH_ATTACHMENT,GLES20.GL_RENDERBUFFER,bufferHandles[0]); GLES20.glRenderbufferStorage(GLES20.GL_RENDERBUFFER,GLES20.GL_DEPTH_ATTACHMENT,width,height); android.openglGLES20glRenderbufferStoragePopularmethodsofGLES20glGetUniformLocationglEnableVertexAttribArrayglVertexAttribPointerglGetAttribLocationglCreateProgramglCreateShaderglUseProgramglAttachShaderglCompileShaderglLinkProgramglShaderSourceglClearglShaderSource,glClear,glClearColor,glBindTexture,glGenTextures,glGetShaderiv,glViewport,glDeleteShader,glActiveTexture,glDrawArraysPopularinJavaMakinghttppostrequestsusingokhttpcompareTo(BigDecimal)getSupportFragmentManager(FragmentActivity)getOriginalFilename(MultipartFile)Returntheoriginalfilenameintheclient'sfilesystem.Thismaycontainpath informationdependingFileNotFoundException(java.io)Thrownwhenafilespecifiedbyaprogramcannotbefound.Collection(java.util)Collectionistherootofthecollectionhierarchy.Itdefinesoperationson datacollectionsandtHashtable(java.util)Aplug-inreplacementforJDK1.5java.util.Hashtable.Thisversionisbasedon org.cliffc.high_scaleVector(java.util)VectorisanimplementationofList,backedbyanarrayandsynchronized.All optionaloperationsinJPanel(javax.swing)Location(org.springframework.beans.factory.parsing)ClassthatmodelsanarbitrarylocationinaResource.Typicallyusedtotrack thelocationofprobleTop15VimPluginsProductsSearchforJavacodeSearchforJavaScriptcodeIDEPluginsIntelliJIDEAWebStormVisualStudioAndroidStudioEclipseVisualStudioCodePyCharmSublimeTextPhpStormVimAtomGoLandRubyMineEmacsJupyterNotebookJupyterLabRiderDataGripAppCodeCompanyAboutUsContactUsCareersResourcesFAQBlogTabnineAcademyStudentsTermsofusePrivacypolicyJavaCodeIndexJavascriptCodeIndexGetTabnineforyourIDEnow
延伸文章資訊
- 1glRenderbufferStorage, glNamedRenderbufferStorage
glRenderbufferStorage is equivalent to calling glRenderbufferStorageMultisample() with the sample...
- 2C++ (Cpp) glRenderbufferStorage Examples - HotExamples
These are the top rated real world C++ (Cpp) examples of glRenderbufferStorage extracted from ope...
- 3OpenGL glRenderbufferStorage 函数详解_jeffasd的博客
OpenGL glRenderbufferStorage 函数详解glRenderbufferStorage 指定存储在renderbuffer中图像的宽高以及颜色格式,并按照此规格为之分配存储...
- 4android.opengl.GLES20.glRenderbufferStorage java code ...
public void glRenderbufferStorageEXT(int param1, int param2, int param3, int param4) { GLES20.glR...
- 5glrenderbufferstorage(3g) [osx man page] - The UNIX and ...
glRenderbufferStorage is equivalent to calling glRenderbufferStorageMultisample() with the sample...