PDA

View Full Version : different index arrays for vertices and texcoords



shosti
06-10-2010, 08:24 AM
Hello,

I'm trying to optimize my rendering function and tried using indexed arrays. The object I'm loading is a dae-export file and the vertex and normal arrays have some 27,000 entries while the texture coord array has only 21,000 entries. So the index arrays for vertices and normals are the same, but the index array for texcoords is different.

glDrawElements only accepts one index array for all data arrays. Is there a possibility to use different index arrays for texcoords? Otherwise I would have to restore the texcoord data to fit it to the other index arrays, which would make the array bigger.

Alfonse Reinheart
06-10-2010, 11:15 AM
Is there a possibility to use different index arrays for texcoords?

Is it "possible"? Yes; with modern hardware, lots of things are "possible."

Is it a directly exposed OpenGL feature? No; you get one index array.

You can use texture buffers and vertex shader logic to do the equivalent, but that's going to be much more costly in terms of performance (and less flexible with regard to vertex format). So if you're going to bother, the memory savings had better be worth it.

shosti
06-10-2010, 11:43 AM
Alright, then I'll rearrange the texture coords and use one index array.
Thanks for your answer!

overlay
06-10-2010, 03:19 PM
FYI, I submitted an "indexing per attribute" feature request last October:

http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Main=51439&Number=2657 44