Budric
12-08-2011, 01:42 PM
Hi,
I'm learning/adjusting to the new 3.0+ standard. I've been reading tutorials and wikis. The approach presented in the wiki (http://www.opengl.org/wiki/Vertex_Buffer_Objects) and this tutorial (http://openglbook.com/the-book/) is to interleave vertex, texture coord, color and normals in the VBO.
To me it seems it can be improved. If I'm drawing 1000 verticies all of the same color, I can cut down the amount of data transmitted to the card. Upload 1 color value, and an array of 1000 index values referring to that color - as opposed to an array of 1000 vec4 color values.
Same can be said for normals. I see that multi index rendering is not the way to go - http://www.opengl.org/wiki/FAQ#Multi_indexed_rendering. (http://www.opengl.org/wiki/FAQ#Multi_indexed_rendering) The solution offered is to allocate separate VBOs for each, or stack the values in blocks in the same VBO. That's fine but in practice how do I render that? Say I want to render a square, 4 verticies, 1 color, 1 normal, can someone provide a sample?
Thanks.
I'm learning/adjusting to the new 3.0+ standard. I've been reading tutorials and wikis. The approach presented in the wiki (http://www.opengl.org/wiki/Vertex_Buffer_Objects) and this tutorial (http://openglbook.com/the-book/) is to interleave vertex, texture coord, color and normals in the VBO.
To me it seems it can be improved. If I'm drawing 1000 verticies all of the same color, I can cut down the amount of data transmitted to the card. Upload 1 color value, and an array of 1000 index values referring to that color - as opposed to an array of 1000 vec4 color values.
Same can be said for normals. I see that multi index rendering is not the way to go - http://www.opengl.org/wiki/FAQ#Multi_indexed_rendering. (http://www.opengl.org/wiki/FAQ#Multi_indexed_rendering) The solution offered is to allocate separate VBOs for each, or stack the values in blocks in the same VBO. That's fine but in practice how do I render that? Say I want to render a square, 4 verticies, 1 color, 1 normal, can someone provide a sample?
Thanks.