opengl - GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT when attaching a cube map texture to a frame buffer object (FBO) -


in order support shadow mapping point lights, need render depth values 6 sides of cubemap.

my init function looks this:

public void init(int width, int height) {     fboid = gl30.glgenframebuffers();      gl11.glenable(gl13.gl_texture_cube_map);     cubemap = gl11.glgentextures();      gl11.glbindtexture(gl13.gl_texture_cube_map, cubemap);      gl11.gltexparameteri(gl13.gl_texture_cube_map,             gl11.gl_texture_min_filter, gl11.gl_nearest);     gl11.gltexparameteri(gl13.gl_texture_cube_map,             gl11.gl_texture_mag_filter, gl11.gl_nearest);     gl11.gltexparameteri(gl13.gl_texture_cube_map, gl11.gl_texture_wrap_s,             gl11.gl_clamp);     gl11.gltexparameteri(gl13.gl_texture_cube_map, gl11.gl_texture_wrap_t,             gl11.gl_clamp);     gl11.gltexparameteri(gl13.gl_texture_cube_map, gl12.gl_texture_wrap_r,             gl11.gl_clamp);      (int = 0; < 6; i++)         gl11.glteximage2d(gl13.gl_texture_cube_map_positive_x + i, 0,                 gl14.gl_depth_component32, width, height, 0,                 gl11.gl_depth_component, gl11.gl_float, (floatbuffer) null);      gl11.glbindtexture(gl13.gl_texture_cube_map, 0); } 

this function use bind side of cube map fbo:

public void bindforwriting(int target) {     // target gl13.gl_texture_cube_map_positive_x etc.      gl30.glbindframebuffer(gl30.gl_draw_framebuffer, fboid);     gl30.glframebuffertexture2d(gl30.gl_draw_framebuffer,             gl30.gl_depth_attachment, target, cubemap, 0);      // disable writes color buffer.     gl11.gldrawbuffer(gl11.gl_none);      int fbostat = gl30.glcheckframebufferstatus(gl30.gl_draw_framebuffer);      if (fbostat != gl30.gl_framebuffer_complete) {         // fbostat == gl_framebuffer_incomplete_attachment     }      gl11.glclear(gl11.gl_depth_buffer_bit); } 

unfortunately, fbo incomplete , can't figure out why. khronos site says: "not framebuffer attachment points framebuffer attachment complete. means @ least 1 attachment point renderbuffer or texture attached has attached object no longer in existence or has attached image width or height of zero, or color attachment point has non-color-renderable image attached, or depth attachment point has non-depth-renderable image attached, or stencil attachment point has non-stencil-renderable image attached. color-renderable formats include gl_rgba4, gl_rgb5_a1, , gl_rgb565. gl_depth_component16 depth-renderable format. gl_stencil_index8 stencil-renderable format."

i did not destroy cube map , width/height > 0. can't see why gl_depth_component16 depth-renderable format, because fbo using spot light shadow mapping works fine gl_depth_component32. if change gl_depth_component16, same error still happens.

any advice?

i found problem:

gl_invalid_enum generated if target 1 of 6 cube map 2d image targets , the width , height parameters not equal. source.


Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

php - MySQLi multi_query results for later use -