This sound small but takes me some time to find out.
My colleague asked me how to access (read or write) GPU buffer on the CPU side.
This is simple, you have to use mapping from OpenGL, so we basically do:
float *data = A.map<float>(GL_READ_ONLY);
// now you can read from data[] table on CPU side
This was trivial, what was not trivial (and I found it out from some examples as my program crashed all the time) - you have to.. unmap this as well after you use it, so you basically do:
A.unmap();
done.
No comments:
Post a Comment