LWJGL Multiple Textures on Cube. (plus opacity)

Hello,
I’ve been reading this site for a few weeks now and I decided to join and ask a question.
I managed to complete a basic breakout game with 3D cubes for the ball and blocks.

I wanted to try texturing and decided to try and create a simple card game.
For the card I wanted a picture of a character with their statistics represented by numbers overlaid on top.

I created the card by creating a thin cube and managed to put a test grid texture on it.
However i’ll need a number texture to appear on top (and perhaps may need some opacity, but that will be the next step)

Within the card object I have this…

	private void setUpTextures()
	{
		texIds[0] = this.loadPNGTexture("res/textures/grid.png", GL13.GL_TEXTURE0);
		texIds[1] = this.loadPNGTexture("res/textures/7.png", GL13.GL_TEXTURE1);

		GameUtils.exitOnGLError("setupTexture");
	}

Which calls the loadPNGTexture where it loads a texture and runs this code


		// Create a new texture object in memory and bind it
		int texId = GL11.glGenTextures();
		GL13.glActiveTexture(textureUnit);
		GL11.glBindTexture(GL11.GL_TEXTURE_2D, texId);

		// All RGB bytes are aligned to each other and each component is 1 byte
		GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1);

		// Upload the texture data and generate mip maps (for scaling)
		GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGB, tWidth, tHeight, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, buf);
		GL30.glGenerateMipmap(GL11.GL_TEXTURE_2D);

		// Setup the ST coordinate system
		GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT);
		GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT);

		// Setup what to do when the texture has to be scaled
		GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
		GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR_MIPMAP_LINEAR);

		GameUtils.exitOnGLError("loadPNGTexture");
		return texId;

Then finally during render
It calls this sections, binds it to the vao, binds buffer, then draws the vertices.

		GL20.glUseProgram(programId);

		// Bind the texture
		GL13.glActiveTexture(GL13.GL_TEXTURE0);
		GL11.glBindTexture(GL11.GL_TEXTURE_2D, texIds[textureSelector]);

		GL13.glActiveTexture(GL13.GL_TEXTURE1);
		// GL11.glEnable(GL11.GL_TEXTURE_2D); // define the type of texture
		GL11.glBindTexture(GL11.GL_TEXTURE_2D, texIds[1]);
		// GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_DECAL);

But I cannot render the texture in GL_TEXTURE1, even when disabling GL_TEXTURE0
One example I found used the lines which I have commented out but they throw “Invalid enum” error.
The second texture will render, but only if a use GL_TEXTURE0

When googling layer / multi textures I do get a lot of results regarding shaders, is this the only where to acheive the requires results?
Any help would be appreciated, thanks.

Well I think you missed out the important code. The actual rendering where you call glDrawXXX(). What you should be doing is drawing the picture. Then switching the texture to the number and drawing that over the picture with the alpha test enabled. You should not need to use two texture units.

So in summary:

-Bind the picture texture.
-Draw the picture.
-Bind the number texture.
-Enable alpha test, disable depth test (if it was ever enabled).
-Draw the number over the picture.