Is it advisable or possible to use the same Buffer for index and vertex?

Started by
1 comment, last by Excors 13 years, 1 month ago
hi, I was wondering if it is possible to store indices and vertices on the same Buffer Object? For example I create a buffer object of size 1mb, and I write vertex data to say the first 512kb and write index data to the next 512kb?

Is it possible to do such thing, or would it be not advisable to do it?

I was thinking since I already have a buffer pool for vertex data, I might as well use it for indices too and even uniform data too.

regards
Advertisement
I don't think its possible, I recall trying it. Don't remember exactly why but I never did it. The best I could get was a single element buffer and a single vertex buffer (with different parts for different materials etc). You should be able to put your uniform data in the vertex buffer, just not indices.

Interested in Fractals? Check out my App, Fractal Scout, free on the Google Play store.

It should be possible, but it's not advisable. The OpenGL 2.0 spec says:
Buffer objects created by binding an unused name to ARRAY_BUFFER and to ELEMENT_ARRAY_BUFFER are formally equivalent, but the GL may make different choices about storage implementation based on the initial binding. In some cases performance will be optimized by storing indices and array data in separate buffer objects, and by creating those buffer objects with the corresponding binding points.[/quote]

This topic is closed to new replies.

Advertisement