I am having an odd problem, occasionally my glReadPixels() from FBO returns garbage. Sometimes it's just mangled pixels, sometimes it's an old image (from rendering before). This happens rarely and seemingly at random. It's very hard to track down the cause because of that. Also this doesn't seem to happen on another machine running ATI drivers. I'm tempted to blame it on the driver.
I'm running nVidia 258.49 drivers. Also tried older version of the drivers 197.xx. Same results
My code is basically:
Code :glBindFramebufferEXT(myBuffer); glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT); ...Do My Rendering... glReadBuffer(GL_COLOR_ATTACHMENT0_EXT); glFinish(); //I initially didn't have this, but why not unsigned char * pixelBuffer = new unsigned char[readWidth*height*3]; glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, (GLvoid*) pixelBuffer); glFinish(); //wait for read to finish GLenum err = glGetError(); //no problems reported here!
Anyone experience anything similar? I'm out of ideas.