Multiple textures for vertex buffers

Started by Iceweasel44, August 29, 2012, 23:08:17

Previous topic - Next topic

Iceweasel44

I'm displaying a grid of tiles to the screen, each tile has the potential to look different from the one next to it. Currently I only have one tileset, which is being used as my only texture. I simply choose different texture coordinates to pick a small piece out of my 512x512 tileset. I would like to be able to have multiple tilesets available for use. Currently, I have a single call to bind the texture

GL11.glBindTexture(GL11.GL_TEXTURE_2D, currentRenderingTile.textureIDList.get(10).getTextureID());


before I make calls to GL11.glVertexPointer, GL11.glTexCoordPointer, and GL11.glDrawArrays. In the code above, I have a textureIDList which is a List of Texture objects. I was hoping to be able to pick from multiple textures for each tile I render, but as I am not making the calls to render each tile, I'm not sure how to go about doing exactly that.

Seems like the alternative is to merge each of my tilesets into one supergigantic texture and then make ALL texture choices simply a choice in texture coordinates. Seems like this method could yield some potentially problematically sized texture objects. What are the limits there?

MattCa

I believe there is something called 'multi-texturing', I've not tried it myself, but from what I know it's an ARB extension (could be mistaken) that lets you apply multiple textures at once.

Theres a NeHe tutorial on it here.