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

Started by
0 comments, last by elanthis 12 years, 1 month ago
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.
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.

This topic is closed to new replies.

Advertisement