draw a texture font in front of the textured mapped Quard

Hi,

I have to use a texutred font in front of the texture mapped Quard:
=> for the textured font, in which the font image is "
arial.glf".
the font is create by :
calling a font library such as myfont.create

=> for the texture mapped Quard . The imaged is bmp file.

Question:

  1. should i need to glGenTextures one more texture for the font?? such as
    glGenTextures (1, &texture[1]);

  2. i don’t want to modify the font library. But how i specify the 2
    textures?? on glEnable(GL_TEXTURE_2D)???

the texture for the Quard is loaded by:

  glGenTextures(1, &texture[0]);     // Create The Texture

  // Typical Texture Generation Using Data From The Bitmap
  glBindTexture(GL_TEXTURE_2D, texture[0]);
  glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage[0]->sizeX,
TextureImage[0]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[0]->data);
  glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
  glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);

code inside the lib for generating the GLtexture :

 //Open input file
 input.open(file_name, ios::in | ios::binary);
 if (!input)
  return false;

 //Read the header from file
 input.read((char *)&header, sizeof(header));
 header.tex = tex;

 //Allocate space for character array
 num_chars = header.end_char - header.start_char + 1;
 if ((header.chars = new GLFontChar[num_chars]) == NULL)
  return false;

 //Read character array
 input.read((char *)header.chars, sizeof(GLFontChar) *
  num_chars);

 //Read texture pixel data
 num_tex_bytes = header.tex_width * header.tex_height * 2;
 tex_bytes = new char[num_tex_bytes];
 input.read(tex_bytes, num_tex_bytes);

 //Create OpenGL texture
 glBindTexture(GL_TEXTURE_2D, tex);
 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
 glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
 glTexImage2D(GL_TEXTURE_2D, 0, 2, header.tex_width,
  header.tex_height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE,
  (void *)tex_bytes);

thanks
zoe

If you want to use a second texture, yes, you should call glGenTextures again to get a second texture handle.

You can create the second one just like the first one, ie glBindTexture(GL_TEXTURE_2D,second_texture_handle);, then glTexImage2D(…).

After creation you can reselect the textures by binding these ‘handles’.

Eg glBindTexture(GL_TEXTURE_2D,the_font_texture);
… render some stuff
glBindTexture(GL_TEXTURE_2D,the_other_texture);
… render some stuff

whereas the second argument is the value you got from glGenTextures.