Results 1 to 2 of 2

Thread: [Xavier Faure] OpenCL to GL

  1. #1
    Junior Member
    Join Date
    Aug 2011
    Posts
    4

    [Xavier Faure] OpenCL to GL

    Hello everybody,

    I have a kernel which computes positions and I want to draw this position.

    Actually, I lost time by these processes :

    1 -> Read the position (cl_mem float4 *) from GPU to CPU
    2 -> glBegin(GL_TRIANGLES);
    glColor4f(0,1,0,1);
    helper::gl::glVertexT(x[a]);
    glColor4f(0,0.5,0.5,1);
    helper::gl::glVertexT(x[b]);
    glColor4f(0,0,1,1);
    helper::gl::glVertexT(x[c]);
    glEnd();
    3 -> And draw (copy CPU to GPU buffer and draw)

    Can I draw directly a variable float4 * openCL ?

    Thanks for your explanations.

    Xavier Faure

  2. #2
    Senior Member
    Join Date
    May 2010
    Location
    Toronto, Canada
    Posts
    845

    Re: [Xavier Faure] OpenCL to GL

    You don't need to read back the data from GPU to CPU. Use Vertex Buffer Objects (VBO) instead so that the data stays in the GPU.

    For that you will need to use the OpenGL/OpenCL interoperability extensions described in sections 9.7, 9.8 and 9.9 of the OpenCL 1.1. specification. Here's a nice tutorial on how that works in practice.
    Disclaimer: Employee of Qualcomm Canada. Any opinions expressed here are personal and do not necessarily reflect the views of my employer. LinkedIn profile.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •