how to call the OpenGL instruction in CUDA?

I have tried it , but the compile said that I have to call the openGL instruction in host.
But when I call it in host , I have to copy the data from GPU to CPU…
Then I can call the OpenGL with these data to finish the process…

It costs me a lot of time…
So…does anyone know how to avoid copying from GPU->CPU that I could
call the OpenGL instructions with data in device ?
thanks~~! :biggrin:

It is not possible to call OpenGL functions directly from kernel (device) functions. If you think about it, this would require the OpenGL driver to run on the GPU.

There are several examples in the SDK (e.g. simpleGL and postProcessGL) that show how to render OpenGL geometry and images from data computed by CUDA . This is fast and does not normally require copying the data from the GPU to CPU.

Thanks~I will try it ~~!