Skip to content

Instantly share code, notes, and snippets.

@LukasBoersma
Created January 20, 2014 22:07
Show Gist options
  • Save LukasBoersma/8530193 to your computer and use it in GitHub Desktop.
Save LukasBoersma/8530193 to your computer and use it in GitHub Desktop.
HD4000 Bug
// Create a texture and bind it to two FBOs
GLuint textureName;
glGenTextures(1, &textureName);
glBindTexture(GL_TEXTURE_RECTANGLE, textureName);
glTexImage2D(GL_TEXTURE_RECTANGLE, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
GLuint fboNames[2];
glGenFramebuffers(2, fboNames);
glBindFramebuffer(GL_FRAMEBUFFER, fboNames[0]);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_RECTANGLE, textureName, 0);
glBindFramebuffer(GL_FRAMEBUFFER, fboNames[1]);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_RECTANGLE, textureName, 0);
glBindTexture(GL_TEXTURE_RECTANGLE, textureName);
glTexImage2D(GL_TEXTURE_RECTANGLE, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glBindFramebuffer(GL_FRAMEBUFFER, fboNames[0]);
// Removing this line resolves the error
glCheckFramebufferStatus(GL_FRAMEBUFFER); // Returns GL_FRAMEBUFFER_COMPLETE
glBindFramebuffer(GL_FRAMEBUFFER, fboNames[1]);
GLenum bufferTarget = GL_COLOR_ATTACHMENT0;
glDrawBuffers(1, &bufferTarget);
// Adding this line resolves the error
// glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_RECTANGLE, 1, 0);
glCheckFramebufferStatus(GL_FRAMEBUFFER); // Returns GL_FRAMEBUFFER_COMPLETE
//This call causes a GL_INVALID_FRAMEBUFFER_OPERATION error.
glClear(GL_COLOR_BUFFER_BIT);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment