PDA

View Full Version : any fetch function for non texture buffers?



laobrasuca
08-16-2010, 05:53 PM
Hi all, I have a trouble here. I'd like to know if there exists any fetch function like texelfetch but to fetch information from buffers targeted with GL_ARRAY_BUFFER or GL_ELEMENT_ARRAY_BUFFER. I ask so because I have a big number of position and index buffers (hundreds actually) to represent a mesh (like, it is subdivided in several regions) and the number of texture buffers is not enough. How do you folks use shaders in situation like this where the number of position/index buffers are very high (like, a big number of different objects)? Joining together all buffers in a big one is not an option to me because my buffers are dynamically created/deleted in an indeterministic manner during the application runtime, and this really often. If I use a for loop to re-target pairs of GL_ARRAY_BUFFER/GL_ELEMENT_ARRAY_BUFFER to texture and call my vertex shader, will the performance drop due to such a high number of re-targetig and shader calls for each draw procedure?

thank you for your attention and time,

lao

Alfonse Reinheart
08-16-2010, 08:04 PM
I'd like to know if there exists any fetch function like texelfetch but to fetch information from buffers targeted with GL_ARRAY_BUFFER or GL_ELEMENT_ARRAY_BUFFER.

There's nothing that says you can't bind those as buffer textures too, even while they're bound as array/element buffers.


I ask so because I have a big number of position and index buffers (hundreds actually) to represent a mesh (like, it is subdivided in several regions) and the number of texture buffers is not enough.

The standard way to render such a mesh is to render one part of it, then bind new buffers and render a different part, etc. This will likely be faster than just letting your shader pull arbitrary data from arbitrary buffer objects.

laobrasuca
08-17-2010, 05:31 AM
hi Alfonse,

thx again for your reply. Yes, this is something that I've learned here with you, to re-bind at will the buffers. I was wondering just how this would impact performance, but since this is the standard way of doing so, it might be fairly well implemented in hardware to avoid performance drops.

thx again for your quite and precise reply,

lao