switching bettween textures in vertex arrays

i’m a beginner in vbo’s so i have a simple question: imagine that i have an object wich uses 2 diferent textures, is there any way of selecting wich texture do i want to use per vertex or do i have to split the object in 2 arrays?

If you supply an alpha value for each vertex (you can pack with the colour in a single RGBA value) you can use that in your texenv setup as a weight to blend between the two textures. If there is no blending of textures but each triangle has either one or the other, you’re better off splitting the mesh up into chunks with only one texture beforehand. You can’t exactly “switch” texture per vertex and even if you could it would be inefficient.

Oh, there’s a slight gtcha, secondary colour normally doesn’t have an alpha component, so be sure to watch out for that. This only matters if you’re using fixed function processing though.

thanks, harsman.

Also bear in mind that you can create one texture out of the two (with an image editor that is) and then change the texture coords to map to the correct portion of this one texture (in a 3d modeller). This makes more sense when both textures are different but part of a single object (say roof and wall texture of a single building) and also saves on texture objects and makes managing them easier. If otoh you want to switch these textures independently of each other (say change the roof texture but keep the wall texture the same) then you have to use two seperate texture objects.