Why am I getting GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT?

I am developing a game for Android, but my target devices are a little slow. In these devices, the color appears differently, in some cases the red is very opaque. As a solution to this, I made the opengl shader the correct colors to match the device. I load textures from SD, then I render the texture to apply the shader and finally I remove the texture with no effect. This is done once per texture load. The problem is that at some point, my code creating the texture starts to crash.

glActiveTexture(GL_TEXTURE0);
glGenTextures(1, &fbo_texture);
glBindTexture(GL_TEXTURE_2D, fbo_texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
glBindTexture(GL_TEXTURE_2D, 0);
glGenFramebuffers(1, &fbo);
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, fbo_texture, 0);
// Disable depth buffer
glDisable(GL_DEPTH_TEST);
glDepthMask(GL_FALSE);

GLint status;
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, fbo_texture, 0);
if ((status = glCheckFramebufferStatus(GL_FRAMEBUFFER)) != GL_FRAMEBUFFER_COMPLETE) {

      

This works fine, but after a moment it crashes and GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT is always returned.

I have no idea because it starts to fail.

Update : I now only use one FBO for all loaded textures, however I am getting a new error on my android device:

eglLockWindowSurface: failed to map the memory for fd=80 offs=2428928
waitForCondition(LockCondition) time out(identity=14,status=0) CPU may be pegged, trying again

      

+3


source to share





All Articles