Textures & Vertex Arrays question...

I have to clear up something in my foggy mind …
Is there a way to use multiple different textures within a single vertex array ?

Is it the glIndexPointer ?

Sorry about this kinda beginner question, but it’s not clear in the documentations i have (A&W books)…

If your opengl card supports multitexture, yes.
Check out the OpenGL 1.2.1 pdf file for the multitexture specs.

Textures have nothing to do with
vertex-arrays. You still can use as many textures as you want but in an vertex array every vertex can only have ONE texcoord and you cannot change the current texture during the functions used to render vertex-arrays


[This message has been edited by XBCT (edited 01-23-2001).]

What i want to do is to use different textures for each polygon in a vertex array.

XBCT, i think we posted simultaneously
Thanks for the answer !

[This message has been edited by paddy (edited 01-23-2001).]

Little ++ question !

So i guess the best way to use several textures on a vertex grid is to use a display list ?

One small correction to XBCT’s answer. You can have one texture co-ordinate per texture per vertex, i.e. when using two texture stages, there are two texture co-ordinate arrays. However, he is correct about not being able to change the textures during a call to glDrawArrays or glDrawElements.

Sorry…DFrey is correct.I just forgot to mention the case with multitexturing enabled…

>So i guess the best way to use several textures on a vertex grid is to use a display list?<

It is really no problem doing it with vertex arrays. You just group your faces by texture and render every group in one
glDrawElements() call. Which method is faster for you depends on your app…
If you give us a more detailed description(Is your geometry static?) we might be able to help you…


Read the multitexture spec in the OpenGl 1.2.1 pdf. In short, it says:
-you can use multitexture with vertex arrays
-you can specify as much texcoord arrays as multitexture stages your hardware support (via glClientActiveTextureARB)
-you can have as much current textures as multitexture stages your hardware has (via glActiveTextureARB,GL_TEXTURE0_ARB, GL_TEXTURE1_ARB, etc )

Of course, you cant change states inside a glDrawElements call, but you can break your geometry in various glDrawElemtents calls if you’re not making too much calls.