View Full Version : OpenGL ES using multiple textures on single plane

02-16-2011, 09:09 PM
Next up on my list of things to figure out! I'm rendering a square that covers the screen, and is to be used to display the 'ground' for a 2D game, where the 'camera' is looking straight downward. I am able to texture the square, however I have multiple textures that I'd like to tile across this object to form different terrain patterns, I've read somewhere that this can be done using vertex arrays and texture coordinates, but I can't seem to find any documentation that specifically goes over what I'm trying to do.

I understand how texture coordinates work, and how they can be used to 'select' part of an image to use as a texture, but how can one 'select' part of a square to be textured?

02-17-2011, 11:43 AM
..bump? >.>

02-17-2011, 04:29 PM
Draw a texture for each small quad ?
Or you want to smoothly blend between textures, for that use an alpha map ?

02-18-2011, 02:29 AM
I need to tile textures across the plane to create a "floor". In example, if I needed 30x30 I can create a square with hundreds of vertices, and then assign each face a different texture, but is it really necessary to create that many vertices and that many faces just to tile different textures across a plane?

02-18-2011, 03:04 AM
In fact 1000 vertices is not much, compared to the cost of switching from a texture to another. If several of the quads use the same texture, draw them all at once.
Sometimes you can use a texture atlas to group all or most of small textures in a single big one, then tweaking texcoords will allow to quickly select which small texture you display. Beware of filtering though.

02-18-2011, 06:36 AM
I have a iPod generation 2 and this thing supports 2 texture units. You could probably search for multitexture and opengl and find a lot of examples since the technology has been available on desktops for 12 years.