Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


GLSL Shared View Matrix


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 TRONJon   Members   -  Reputation: 226

Like
0Likes
Like

Posted 15 April 2014 - 06:07 AM

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.



Sponsor:

#2 RobTheBloke   Crossbones+   -  Reputation: 2349

Like
2Likes
Like

Posted 15 April 2014 - 06:44 AM

Uniform blocks are pretty much the best bet. 



#3 mhagain   Crossbones+   -  Reputation: 8156

Like
2Likes
Like

Posted 15 April 2014 - 06:56 AM

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).


It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.


#4 TRONJon   Members   -  Reputation: 226

Like
0Likes
Like

Posted 15 April 2014 - 04:23 PM

Fantastic, thanks guys! :)



#5 Irlan   Members   -  Reputation: 1617

Like
0Likes
Like

Posted 23 April 2014 - 06:52 AM

UBO.

http://www.opengl.org/wiki/Main_Page






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS