//createthetexture
GLuinttexture;
glGenTextures(1,&texture);
glBindTexture(GL_TEXTURE_2D,texture);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA8,width,height,0,GL_RGBA,GL_UNSIGNED_BYTE,NULL);
glFramebufferTexture2D(GL_FRAMEBUFFER,GL_COLOR_ATTACHMENT0,GL_TEXTURE_2D,texture,0);
关于Rendertotexture看到iOS的opengles编程指南中的代码,如上所示,glTexImage2D函数中,最后一个参数为NULL,系统会自动的分配texture的空间吗?按照他的思路,我在执行中,老是检验FrameBuffer失败。
GLenumstatus=glCheckFramebufferStatus(GL_FRAMEBUFFER);
if(status!=GL_FRAMEBUFFER_COMPLETE){
NSLog(@"failedtomakecompleteframebufferobject%x",status);
}
分 -->
|