I have rendered some geometry information (norm, location) into pbuffer, then bind it to texture.
Are there any methods I can directly access the pbuffer or texture content in my code other than sampler in fragment shader? (For my program’s logical sequence depends on the information).
I have got the texture coordinate information, and anyway “glGetTexImage” may be a solution. Are there any other faster APIs?
glGetTexImage is the way that comes to mind to transfer texture data to system memory. Be aware however, that this may come at a noticeable performance cost.
If you need to do it that way, it may even be faster to render to the back buffer and use glReadPixels - that would save you the context switch to render to the pbuffer.
On a side note, when superbuffers arrive, problems like these are finally supposed to be solvable at decent performance. I sure hope that the ARB has noticed how big the demand for this is, and how important superbuffer functionality actually is
Superbuffers spec is in development by the ARB. A group works on it. Look at the ARB meeting notes.
I have noticed that glGetTexImage doesn’t work right for cubemaps on ATI and if you want speed avoid reading back anything from the server side. If it’s a 2D tex, then it’s fine on NV and ATI.
There is basically 2 ways to read back :
ReadPixels
GetTexImage
but GetTexImage might perform worst because it’s part of the API that is ignored.