• Advertisement
Sign in to follow this  

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

This topic is 2231 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

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.

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


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

  • Advertisement