Shader loading with multiple viewports

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

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.

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

wglShareContext and such should avoid reloading separately for each window.

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.

Thanks ZbuffeR,

Alberto

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.