PDA

View Full Version : glDrawArrays - Multiple Textures



EuadeLuxe
06-16-2013, 12:42 PM
Hi you all out there,

Im sitting over a problem that will probably be quite easy for you advanced coders. Im using glDrawArrays and Ive got a buffer that holds the texture coordinates and the vertices. All this does is drawing a cube on my screen. Everything works fine, but now I wanted to attach multiple textures to the cube, so the left side can have an other texture than on the right side, for example. Since I put all vertices and texture coordinates in one single buffer I wonder if theres the possibility of using multiple texture with only one call to glDrawArrays. Is it possible to put texture ids into that buffer, too?

Thank you for any help,
EuadeLuxe.

tonyo_au
06-16-2013, 11:41 PM
You can supply more than one set of UV values and more that one texture for drawing. Are you using shaders or basic OpenGL - it makes a difference how hard/easy this is to do. It is easy with a shader - if the U/V value is < 0.5 select a pixel from the left texture else select from the right texture.