android - When binding an fbo do you need to call glFramebufferTexture2D every frame? -


on each draw frame when bind fbo supposed call

gles20.glframebuffertexture2d(gles20.gl_framebuffer,                 gles20.gl_color_attachment0, gles20.gl_texture_2d,                 resourcemanager.windowtex[0], 0); 

are supposed call when initialize framebuffer or every frame? doesn't draw me unless call after glbindframebuffer.

the attachment bindings part of fbo state. need call glframebuffertexture2d() once, while fbo bound. same textures still attached when later bind same fbo again.

one possible trap texture object must have been created before can attached fbo. generating name alone not enough, needs bound @ least once create actual texture object. example, following error:

gluint texid = 0; glgentextures(1, &texid);  gluint fboid = 0; glgenframebuffers(1, &fboid); glframebuffertexture2d(gl_framebuffer,     gl_color_attachment0, gl_texture_2d, texid, 0);  glbindtexture(gl_texture_2d, texid); glteximage2d(...); 

the texture object not created in case before being attached fbo. following on other hand valid:

gluint texid = 0; glgentextures(1, &texid); glbindtexture(gl_texture_2d, texid); glbindtexture(gl_texture_2d, 0);  gluint fboid = 0; glgenframebuffers(1, &fboid); glframebuffertexture2d(gl_framebuffer,     gl_color_attachment0, gl_texture_2d, texid, 0);  glbindtexture(gl_texture_2d, texid); glteximage2d(...); 

note texture not have bound when glframebuffertexture2d() called, , it's not necessary texture data have been specified @ point. needs have been bound @ least once trigger creation of texture object.


Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -