[GEM-dev] more on multitexturing

chris clepper cgc at humboldtblvd.com
Tue Dec 20 00:06:18 CET 2005


I spent today trying to get actual multitexturing working using
arb_fragment.  In order to use shaders with texture units other than
the first one the texcoords need to be passed to the remaining units. 
So if I have a luma/chroma key shader, I need to put a texture on unit
0 and also on unit1.  Just enabling them doesn't actually texture them
properly though.  I added the following to SetVertex() in GemShape:

if (state->numTexCoords) {
      glTexCoord2f(state->texCoordX(curCoord), state->texCoordY(curCoord));
	  glMultiTexCoord2fARB(GL_TEXTURE1_ARB,state->texCoordX(curCoord),
state->texCoordY(curCoord));
	  }
    else {
		glTexCoord2f(tx, ty);
		glMultiTexCoord2fARB(GL_TEXTURE1_ARB,tx,ty);
		}

Doesn't look so bad right?  Well, in order to cover every one of the
texture units available, they have to be textured onto properly.  So
for an eight texture unit GPU that's GL_TEXTURE[0..7]_ARB and so on. 
Is this something that I should go ahead and do?




More information about the GEM-dev mailing list