How many OpenGL contexts can I create? OpenGL interoperability

I am trying to create a MFC application in which I can open image and run various image-processing algorithms - sort of a mini-photoshop.
If I want to open multiple images, I need to create multiple OpenGL contexts - one for each window/image.

Can I do that using CUDA? I am trying to use the OpenGL PBO.
Currently, my first image opens and runs fine, but when I try to open another image, creating the PBO fails and crashes the program.

What might be a better way, if there is one?

The Programming Guids states “A CUDA context may interoperate with only 1 Direct3D device…”, but it does not talk about any such limit on the OpenGL notes.

Anyone have tried something like this yet?

Thank you!

Interestingly I can run multiple instances of my application without any problems. But if I try to open a new OGL window in one of those apps, it crashes.

It crashes when I try to register my PBO object using -


Solved! But I cannot explain why, I can tell how -

When I was registering my PBO (GLuint pbo) I was using -



This crashed the application when I attempted to create a new window in the application itself with its own PBO.

I just removed the CUDA_SAFE_CALL macro and now I can create as many new windows I want inside my application. So essentially I use -


Which version of CUDA are you currently using?

I am using the cuda version released on 11/13/07 -
Forceware version - 169.09
I also have the 1.1 beta versions for the toolkit and sdk.

Just in case you need the machine config -
AMD Athlon X2 dual core, GeForce8800 GTX