Advertisement Jump to content
Sign in to follow this  
TRONJon

OpenGL GLSL Shared View Matrix

This topic is 1729 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm upgrading all of my OpenGL code to support the newer specifications, as a result I don't want to use the standard matrices in my GLSL code, such as gl_ModelViewMatrix or gl_ModelViewProjectionMatrix.. I wish to use my own matrices, except the problem I see is I'm using many shaders in my engine. It would be counter productive to upload a seperate set of uniform view matrices to every shader therefore I would need to have shared matrices.

 

I know about Uniform Buffer Objects and Uniform Blocks... but have not use them yet, are these the only way of sharing data between different shaders? I'm just looking for someone with experience to shed some light on the subject.

 

Many thanks, Jon.

Share this post


Link to post
Share on other sites
Advertisement

Unfortunately you can't do this with GLSL and standalone uniforms.  Like RobTheBloke said, use a uniform block: you'll probably find that you've got a bunch of other data that never changes or changes relatively infrequently (once per frame) which it also makes sense to put in there (maybe lightstyle values, view vectors for billboarding, etc).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!