Getting matrices from buffer

Discussion created by Meteorhead on Dec 12, 2011
Latest reply on Dec 13, 2011 by nou
Efficient CL_GL interop

Hi! I would like to ask a question concerning OpenGL 4.x . I'd like to know what efficient way exists to read world matrices of objects from VRAM? I'd like to have some entites that I want to draw, but I'd like to move them around and set their world matrices from OpenCL. This would allow physics (with collision detection and everything) to be calculated on the GPU without host intervention whatsoever. I would also like to avoid mapping results back to host to set uniform variables to shaders for the different entities. Problem is, that world matrix is unique on a per-entity basis, not even per-vertex or per-primitive. Could you tell me some efficient way to do this? I could use pinned memory to map the results of world matrix calculation on device to host memory, and send it back to device the usual way by setting uniform vairables, but even this mem movement could be avoided. I am familiar with OpenCL enough, but I'm just learning OpenGL, and I have not found a means to read from VRAM that exists as a single copy and could be easily distinguished on a per-object basis. Thank you in advance, Máté