After some time I’m rewriting a version of an QGLWidget that takes gpu memory and displays it with the help of the CUDA + OpenGL interoperability functions. As those changed a lot during the last versions I rebuilt this from scratch and now came to the problem that this only works if I call cudaGLSetGLDevice at the very beginning of my application. This is not a problem for my test app but for general usability of the widget, which will be included in a general library for cuda usage, it is. I don’t want to bother the user that a (dummy) OpenGL context has to be created and the GL device has to be set before any other work is done on the GPU. I don’t want to change the current card or something like that during processing but only use the current gpu registered cuda context to use the opengl interop stuff. Is there a nice and plain solution for that?
When I for example call cudaSetGLSetDevice while the init of OpenGL I get the message: “setting the device when a process is active is not allowed”