PDA

View Full Version : question on textures and vertex arrays



Martin_unique
01-09-2003, 02:19 PM
Hello,
I'm somewhat confused on how to put textures and vertex arrays together. I thought that once you put all the data you want to draw into vertex arrays you're done - you just call glDrawArrays on the entire array and everything is rendered. But certain polygons in my code use different textures. Is there a way to specify which texture should be used for which vertices beforehand, or do I have to to it 'manually', which is: bind texture, draw a sub-range of vertices, repeat ? I would appreciate if someone could share his/her experience on this one.
Regards,

Martin

Morglum
01-10-2003, 12:22 AM
With plain ogl vertex arrays, there's no way to change the texture inside a vertex array, so yes, you have to split it manually.

I don't know whether there's an extension to address this issue.

T
01-10-2003, 12:31 AM
I don't think there is any extension available.

Which would be quicker? Creating separate vertex arrays, one for each texture and using DrawArrays, or one vertex array using DrawElements to draw sub-sections of it?

Morglum
01-10-2003, 01:02 AM
Most probably the second option, especially with CVAs, since it's generally a good idea to minimize the number of gl calls.