cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

Meteorhead
Challenger

Getting matrices from buffer

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é
0 Likes
1 Reply
nou
Exemplar

i think you should look into this http://www.opengl.org/wiki/Uniform_Buffer_Object

it allows bind buffer to shader. also if you draw same geometry multiple times you can use also a geometry instancing http://www.opengl.org/wiki/Vertex_Specification#Instancing

0 Likes