Archived

This topic is now archived and is closed to further replies.

Help with VA's - Interleaved Arrays

This topic is 5115 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey all. So I've got multiple models (some smooth-shaded, some texturemapped) and I want to combine them into a single vertex array. Now I know performance wise this is bad, please dont waste space telling me that. I've so far combined the vertices into single array, and they render fine with texturing/color off. But i'm having trouble combining the color_array and texture_array. How does the interleaved array work, i cant seem to find any good readings. Thanks! [edited by - code_evo on December 14, 2003 1:55:47 AM]

Share this post


Link to post
Share on other sites
interleaved is meant to store the data for your vertex in an interleaved fashion
pos/col/norm/tex etc..
compared to seperate arrays.

it is NOT meant to store completely different kinds of stuff together like some vertices with colors and others with tex coords. either every vertex has all that information or not. your problem isnt storing it though, but that you cant tell opengl to disable textures in the middle of drawing an array.

what you want to do is not just slow, its not meant to be done, a bad idea and impossible until you write your own vertex/fragment program and add additional data to each vertex specifying if its meant to be colored or textured. even then without being able to have jumps and branches (none worth mentioning at least) this would be quite some trick and so much hassle that its absolutely not worth it.

in other words: dont waste your time trying to hammer stuff into a single array that doesnt belong together.


if of course you are still planning to have TWO draw calls (once for colored and once for textured vertices) that would be a lot easier, though you would have to make some extra calls and let opengl know that the setup for the interleaved array is now different which again would mean: having it in one array in the first place is kind of pointless and causing unnecessary extra work (and usually headache).

Share this post


Link to post
Share on other sites