title: Multiple Textures OpenGL GLUT C++
body: <p>Okay still having a few problems with it, this is what I have so far: </p>
  
  <pre><code>Bitmap Display::m_HeightMap;
  unsigned int Display:: textures;
  </code></pre>
  
  <p>My initialise method:</p>
  
  <pre><code> glEnable(GL_TEXTURE_2D);
  
  Bitmap image[2];
  GLuint *textures = new GLuint[2];
  glGenTextures(1, textures);
  glGenTextures(2, textures);
  image[0].loadBMP("myTexture.bmp");
  image[1].loadBMP("myOtherTexture.bmp");  
  
      glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE , GL_MODULATE);
      glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
  
      glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
      glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
      glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
      gluBuild2DMipmaps(GL_TEXTURE_2D, 3, image.width, image.height, GL_RGB, GL_UNSIGNED_BYTE, image.data);
  </code></pre>
  
  <p>The above line gives an error: left of .data must have class/struct/ union</p>
  
  <pre><code>glDisable(GL_TEXTURE_2D);
  </code></pre>
  
  <p>Draw Method: </p>
  
  <pre><code>void Draw()
  {
  glEnable(GL_TEXTURE_2D);
  glBegin(GL_QUADS); //TOP
  glBindTexture(GL_TEXTURE_2D, textures[0]);
  glNormal3f(0,1,0);
  glColor4f(1,1,1,0);
  //glColor3d(0.5,0.40,0.05);
  glTexCoord2f(0.0f,0.0f);
  glVertex3f(-4.5, 0.3, 2);//bottom left
  glTexCoord2f(1.0f,0.0f);
  glVertex3f(-4.5, 0.3, 2.5);//bottom right
  glTexCoord2f(1.0f,1.0f);
  glVertex3f(4.5, 0.3, 2.5);//top right
  glTexCoord2f(0.0f,1.0f);
  glVertex3f(4.5, 0.3, 2);//top left
  glEnd();
  glDisable(GL_TEXTURE_2D);
  }
  </code></pre>
  
  <p>Only problem here is that texture is undefined.</p>
  
  <p>One last thing hopefully! </p>
  
  <pre><code>void loadTexture(GLuint texture, const char* filename)
  {
     Bitmap image;
  
     Bitmap image[2];
  
     image[0].loadBMP("myTexture.bmp");  &lt;=== error 
     image[1].loadBMP("myTexture2.bmp"); &lt;=== error
  
  
     glBindTexture(GL_TEXTURE_2D, texture);
  
     glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE , GL_MODULATE);
     glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
  
     glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
     glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
     glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
     gluBuild2DMipmaps(GL_TEXTURE_2D, 3, image.width, image.height, GL_RGB, GL_UNSIGNED_BYTE, 
  </code></pre>
  
  <p>image.data);
  }</p>
  
  <p>When I try and load multiple bitmaps I get 7 errors, </p>
  
  <p>error C2040: image:'Bitmap [2]' differs in level of indirection of 'Bitmap'<br>
  error C2088: '[' illegal for class (twice)<br>
  error C2228: left of .BMP must have class/struct/union (twice)<br>
  no operator "[]" matches these operands (twice)  </p>