I use 2 methods to read my texture. The first method works perfectly and it gives me the exact texture. But I not sure why method 2 give me nothing?My program just end after printing the message “Data after roundtrip”. Why?
Checking “if(GL_FRAMEBUFFER_COMPLETE_EXT)” will always result in the condition being evaluated to true because what is actually being evaluated is “if (0x8CD5 != 0)”.
If your application is terminating unexpectedly, then maybe “result” isn’t large enough to store all the data? This would mean that when OpenGL tries to write to “result”, it would end up overwriting other application data.
Have you also tried calling glGetError to see if any OpenGL errors have occurred?
The glReadPixels there prompt error. Invalid operation. Does glReadBuffer bind the fbo to the context? Even though it does not, i already add glBindFramebufferEXT to bind the fbo. However, still have the same problem. I not sure how to troubleshoot the problem now. What I know now is the glReadPixels generates an error.
The above link shows that GL_LUMINANCE is the supported format. But according to the link you give me, seems like GL_LUMINANCE does not support in glReadPixels.
Then which format should I use since I jz want to use one component only in every pixels instead of using RGB format that have 3 components. I just want every pixel store one byte of component instead of 3 bytes.
Actually I not sure what is core profiles, my openGL version is just 1.4 only.
Then none of what he said matters to you. It only matters if you’re using GL 3.1 and above, and then only if you don’t want to use the compatibility profile.