PDA

View Full Version : Shader loading with multiple viewports



devdept
08-05-2010, 06:38 AM
Hi All,

We are reloading shader programs for each viewport have on our application bui is it really necessary?

Can shader programs be shared by all viewports of the same application?

Thanks,

Alberto

strattonbrazil
08-05-2010, 08:09 AM
What API are you using? I believe it's possible, but you might need to do a couple things to make sure they are all sharing the same context. I believe JOGL and Qt, for example, have controls for this, but GLUT does not.

devdept
08-05-2010, 12:14 PM
Ah, therefore generally you need to load the same shader program 4 times if you have 4 opengl viewports...

I thought I was doing something wrong.

Thanks,

Alberto

ZbuffeR
08-05-2010, 12:56 PM
wglShareContext and such should avoid reloading separately for each window.

strattonbrazil
08-05-2010, 04:25 PM
No, not generally. I'm saying that sharing that across windows requires some additional setup outside of OpenGL, which is different for each windowing library you're using. It's usually not hard. It's just specific to the windowing library. GLUT is one that doesn't support sharing, as far as I know.

devdept
08-06-2010, 12:33 AM
Thanks ZbuffeR,

Alberto