PDA

View Full Version : Shader Programs and DC's



Tomy
03-23-2005, 07:56 AM
Hi,

Can the same shader program be used in more than one DC at the same time?

Humus
03-23-2005, 06:59 PM
Should be no problem.

yooyo
03-23-2005, 10:22 PM
Well, Im not sure... For example you can install two graphics card, AGP & PCI (geforce/ati + matrox g450). This is two different DC and when you create GLRC on both DC, I'm quite sure that you cant share objects between this two RC's.

yooyo

Humus
03-24-2005, 04:10 PM
DC/RC, same **** different name. :p No, you're quite right. Mixed it up. You can share program objects between GL contexts, but you can obviously not share contexts between implementations on different GPUs, nor can you share between two processes.

Tomy
03-25-2005, 10:35 PM
Thanks everybody for your posts...

My situation here, is that I have multiple windows in the same application. I need to change the palettes in all of them at the same time by replacing the 1D textures. I do not need different shading code to do this. I created only one shader program and tried to use it in the displaying function of all the windows. The shader didn't work except for one window. When I created multiple copies of the same shader programs and assigned one program to every window, it worked fine. I am new to shading, can there be anything that I did wrong or is there an obvious reason for that thet I don't know? :eek: :)

Sergey K.
03-26-2005, 12:47 AM
Check out for wglShareLists()

yooyo
03-26-2005, 03:02 AM
Instead creating rendering context (RC) for all windows you can create one RC for all. Just override OnPaint event and do wglMakeCurrent at beggining and SwapBuffers at end of this func. Remember to call SetPixelFormat with same PixelFormat for all windows.

No object sharing, but you must track GL state changes.

yooyo