Jump to content

  • Log In with Google      Sign In   
  • Create Account

Sending thousands of uniforms to a shader. (3.2 -4.0)


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
1 reply to this topic

#1 Simon_Roth   Members   -  Reputation: 149

Like
0Likes
Like

Posted 13 March 2012 - 06:17 PM

Hi

I'm trying to get a lot of light data into a shader to perform deferred lighting.

The lighting system populates the screen with 32*32 tiles, which are drawn instanced onto the screen. Each tile needs to be fed the data for 8 point lights.

I'm struggling to get my head around how to get the data to the shader in GLSL. Currently I have a large UBO with all the tile light arrays in, and can rebind the UBO at the correct data struct for each tile. However, when doing this, I can't use a single instanced call. So thats not fast enough.

Is there any way I can just bind the whole UBO? Trying to define a large array in GLSL (understandably) causes the shader not to link.

I know I can do this relatively easily by packing the data into a texture, but I'd like to know if there is a more intuative way that fits the uniform paradigm.

Sponsor:

#2 elanthis   Members   -  Reputation: 126

Like
1Likes
Like

Posted 15 March 2012 - 05:43 PM

Texture buffer objects exist specifically to solve this problem. They're pretty straight forward to use and easy to look up on the OpenGL wiki.




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