View Full Version : Opengl 3.1, and Uniform Blocks question.

Jose Goruka
06-21-2009, 10:03 AM
Here's a question... Is it possible to create a Buffer Object that holds vertex attributes ( GL_ARRAY_BUFFER ), fill it with data using transform feedback, and finally, bind it as a uniform block ( GL_UNIFORM_BLOCK )? (I need it this way so i can access the contents in random order from the vertex program..)


Alfonse Reinheart
06-21-2009, 10:35 AM

You do not need to bind a Buffer Object to GL_ARRAY_BUFFER to use feedback.

Implementations have a specific limit to the size of uniform buffers. The minimum value is 16KB. This is only 4096 floats.

Be aware also that this will not be faster than sending vertex attributes normally.

Jose Goruka
06-21-2009, 03:16 PM
Alfonse, Many thanks for your answer!

I assume that in modern cards (8800/radeonHD) this should be at least a little higher, right? Also, I'll be more than happy enough if this is faster than processing on CPU.

06-21-2009, 03:45 PM
No,on 8x and HD cards uniform buffer can hold only 4096 vec4 elements.
If you need more, then you can put them in float 2d texture (max 8192x8192 size).

Alfonse Reinheart
06-21-2009, 04:27 PM
I assume that in modern cards (8800/radeonHD) this should be at least a little higher, right?

Those are the bare minimum hardware that support uniform buffers at all.

If you need more space, use texture buffer object. They have room for 64K worth of vec4s.

If you need more space, you can confine yourself to NVIDIA hardware of 9xxx grade or better, and use the bindless API.

I think that what you are trying to do would work best as OpenCL code.