glFramebufferTexture2D给立方体贴图纹理造成损坏

我正在使用glFramebufferTexture2D与立方体贴图纹理,但它在纹理中给腐败。 draw_cube()函数完美的工作,当我在默认的帧缓冲区绘制。

GLenum types[]={GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_X, GL_TEXTURE_CUBE_MAP_POSITIVE_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, GL_TEXTURE_CUBE_MAP_POSITIVE_Z, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z }; GLuint Fboid; glGenTextures(1, &id1); nResult |= GL_ERROR_CHECK((GL_NO_ERROR, "glGenTextures(1, &id1);")); glBindTexture(*target11, id1); nResult |= GL_ERROR_CHECK((GL_NO_ERROR, "glBindTexture(*target11, id1);")); glGenFramebuffers(1, &Fboid); nResult |= GL_ERROR_CHECK((GL_NO_ERROR, "glGenFramebuffers(1, &Fboid);")); GLint fl=0; switch(*target11) { case GL_TEXTURE_CUBE_MAP: for(int i=0;i<6;i++) { glTexImage2D(types[i], 0, GL_RGBA_16_SNORM,32,32, 0, GL_RGBA, GL_BYTE,0); } glTexParameteri(*target11, GL_TEXTURE_MIN_FILTER,GL_NEAREST); nResult |= GL_ERROR_CHECK((GL_NO_ERROR, "glTexParameteri(*target11, GL_TEXTURE_MIN_FILTER,GL_NEAREST);")); glTexParameteri(*target11, GL_TEXTURE_MAG_FILTER, GL_NEAREST); nResult |= GL_ERROR_CHECK((GL_NO_ERROR, "glTexParameteri(*target11, GL_TEXTURE_MAG_FILTER, GL_NEAREST);")); glTexParameteri(*target11, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); nResult |= GL_ERROR_CHECK((GL_NO_ERROR, "glTexParameteri(*target11, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);")); glTexParameteri(*target11, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); nResult |= GL_ERROR_CHECK((GL_NO_ERROR, "glTexParameteri(*target11, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);")); break; } GLint framebuffer; glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING,&framebuffer); nResult |= GL_ERROR_CHECK((GL_NO_ERROR, "glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING,&framebuffer);")); glBindFramebuffer(GL_FRAMEBUFFER, Fboid); nResult |= GL_ERROR_CHECK((GL_NO_ERROR, "glBindFramebuffer(GL_FRAMEBUFFER, Fboid);")); glBindRenderbuffer(GL_RENDERBUFFER, depth); nResult |= GL_ERROR_CHECK((GL_NO_ERROR, "glBindFramebuffer(GL_FRAMEBUFFER, Fboid);")); glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, width1, height1); nResult |= GL_ERROR_CHECK((GL_NO_ERROR, "glBindRenderbuffer(GL_RENDERBUFFER, depth);")); glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depth); nResult |= GL_ERROR_CHECK((GL_NO_ERROR, "glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depth);")); } switch(*target11) { case GL_TEXTURE_CUBE_MAP: for(int i=0;i<6;i++) { glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER,GL_COLOR_ATTACHMENT0,types[i],id1,0); nResult |= GL_ERROR_CHECK((GL_NO_ERROR, "glFramebufferTexture1D(GL_DRAW_FRAMEBUFFER,GL_COLOR_ATTACHMENT0,*target11,id1,0);")); draw_cube(fl); } break; } unsigned int status = glCheckFramebufferStatus(GL_FRAMEBUFFER); switch(status) { case GL_FRAMEBUFFER_COMPLETE: tdkPrintf("GL_FRAMEBUFFER_COMPLETE\n"); break; case 0x8CDB: tdkPrintf("GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER\n"); break; case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT: tdkPrintf("GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT\n"); break; case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: tdkPrintf("GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT\n"); break; case GL_FRAMEBUFFER_UNSUPPORTED: tdkPrintf("GL_FRAMEBUFFER_UNSUPPORTED\n"); break; default: tdkPrintf("Unknown issue (%X).\n",status); break; } glBindFramebuffer(GL_FRAMEBUFFER, framebuffer); nResult |= GL_ERROR_CHECK((GL_NO_ERROR, "glBindFramebuffer(GL_FRAMEBUFFER, 0);")); glUseProgram(shader_data.psId); nResult |= GL_ERROR_CHECK((GL_NO_ERROR, "glUseProgram(shader_data.psId)")); glViewport(0, 0, GetViewportWidth(), GetViewportHeight()); nResult |= GL_ERROR_CHECK((GL_NO_ERROR, "glViewport(0, 0, GetViewportWidth(), GetViewportHeight());")); cube() } 

该问题仅出现在幼仔地图纹理上。 对于GL_TEXTURE_2D,它工作得很好。 我也validation了着色器。

用glFramebufferTexture2D与上面的代码的立方体贴图纹理给IMG驱动程序currption,但与AMD驱动程序正常工作。 它有任何实施差异或IMG驱动程序是越野车?