Multi-texturing problem

Started by
2 comments, last by Ataru 22 years ago
Is it possible to render more than 2 textures in a single pass, or am I doomed to doing 2 passes? I read that only GEforce3 and up have more than 4 texture units (I have a GEforce 3, but i want to make my game run on more than just my comp.) However, I know that glClientActiveTextureARB supports up to 4 textures. So can you render 4 or not? I got two textures to render fine using multitexturing, but when I added two more they would not display. Here is the code: Is there anything I can do, or do I have to render twice?
  
void t_displayRec()
{
  //Set texture env

  glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);

  //Enable client states

  glEnableClientState(GL_VERTEX_ARRAY);
  glEnableClientState(GL_TEXTURE_COORD_ARRAY);

  //Texture 1

  glClientActiveTextureARB(GL_TEXTURE0_ARB);
  glEnable(GL_TEXTURE_2D);
  glTexCoordPointer(2, GL_FLOAT, 0, tVA_tex);
  terrainTextures[0].Use();
  glActiveTextureARB(GL_TEXTURE0_ARB);

  //Texture 2

  glClientActiveTextureARB(GL_TEXTURE1_ARB);
  glEnable(GL_TEXTURE_2D);
  glTexCoordPointer(2, GL_FLOAT, 0, tVA_tex);
  terrainTextures[1].Use();
  glActiveTextureARB(GL_TEXTURE1_ARB);

  //Texture 3

  glClientActiveTextureARB(GL_TEXTURE2_ARB);
  glEnable(GL_TEXTURE_2D);
  glTexCoordPointer(2, GL_FLOAT, 0, tVA_tex);
  terrainTextures[2].Use();
  glActiveTextureARB(GL_TEXTURE2_ARB);

  //Texture 4

  glClientActiveTextureARB(GL_TEXTURE3_ARB);
  glEnable(GL_TEXTURE_2D);
  glTexCoordPointer(2, GL_FLOAT, 0, tVA_tex);
  terrainTextures[3].Use();
  glActiveTextureARB(GL_TEXTURE3_ARB);

  //Enable vertex pointer for VA

  glVertexPointer(3,GL_FLOAT,0,tVA_vertices);

  //Display terrain

  t_createQuadTree(quad_root, 0,xWORLD-1,0,yWORLD-1,MAX_LEVEL-1);
  t_displayRec(quad_root);

  //Disable client states

  glDisableClientState(GL_VERTEX_ARRAY);
  glDisableClientState(GL_TEXTURE_COORD_ARRAY);
  
}
  
[edited by - Ataru on April 7, 2002 12:04:49 PM]
Advertisement
You can use as much textures in one pass as you have texture units.

a side note: if you have same texcoords for all texturing units you can just set this array for GL_TEXTURE0_ARB and the rest will use that (I think)

There are more worlds than the one that you hold in your hand...
You should never let your fears become the boundaries of your dreams.
everythings in your codes mixed up use

glClientActiveTextureARB(GL_TEXTURE0_ARB);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(2, GL_FLOAT, 0, tVA_tex);

glActiveTextureARB(GL_TEXTURE0_ARB);
glEnable(GL_TEXTURE_2D);
terrainTextures[0].Use();

yes 4 textures in one pass (gf3) is possible

http://uk.geocities.com/sloppyturds/gotterdammerung.html
everythings in your codes mixed up use

glClientActiveTextureARB(GL_TEXTURE0_ARB);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(2, GL_FLOAT, 0, tVA_tex);

glActiveTextureARB(GL_TEXTURE0_ARB);
glEnable(GL_TEXTURE_2D);
terrainTextures[0].Use();

yes 4 textures in one pass (gf3) is possible ( look into more advanced methods of combining textures )

http://uk.geocities.com/sloppyturds/gotterdammerung.html

This topic is closed to new replies.

Advertisement