Our PC has two FX7800 cards (a SLI machine but with SLI disabled). Each card has 2 DVI outputs, and each DVI output connects to a monitor.
To see if textures between different opengl contexts can be shared, I did the simple test as followed:
I created 2 opengl contexts, each has its own rendering window. I used my own Win API routines to create window instead of using glut, because glut can only allow 1 window be active at any given time.
// in opengl context0, I copied frame buffer => texid0:
glBindTexture (GL_TEXTURE_2D, texid0);
glCopyTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, 0, 0, 512, 512);
// in opengl context1, I copied frame buffer => texid1:
glBindTexture (GL_TEXTURE_2D, texid1);
glCopyTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, 0, 0, 512, 512);
After that, in my display function:
// bind texid1 to context0, and render it:
glBindTexture (GL_TEXTURE_2D, texid1);
// texture mapping and display it
//…
// texid0 => context1, render it…
glBindTexture (GL_TEXTURE_2D, texid0);
//render it…
My experiment results are:
-
If 2 windows are displayed in same monitor, their textures can be shared between each other.
-
But if the two windows are on different monitors (even within the same GPU), textures are NOT sharable. But if the windows are dragged together in a single monitor, texture sharing will work again.
I created a single window (but different glviewports) that spans all 4 monitors. I got the same results as above.
I am using the latest nvidia driver. And called the wglShareLists (…) twice to establish a mutual share (do I have to call it twice?).
It is really important for me if I can make textures shared!
Is anybody knows if it is possible to share textures between two windows that are on two separate Displays? If so, is there any sample code you can point me? Is there any special driver setting needed?
Thanks!