title: Texture appears white
body: <p>I have a textured skydome. It renders white when an image is attached, but it does renders right when a color is given. I have reasons to assume the texture is overwritten, thus some tips on this would be great. It used to work fine, displaying the texture appropriately.</p>
  
  <p>EDIT: If I print the texture directly to the fbo, it does show the texture. However when I map it to the sphere it shows up white. Give the sphere a color, and it shows correctly with the color. Also for the record, white is not the clear color. And I use an image that's quite large (3000x1000~).</p>
  
  <p>ADD: No errors are given anywhere.</p>
  
  <p>Changing:</p>
  
  <pre><code>glActiveTextureARB(GL_TEXTURE6_ARB);
  glCallList(SkySphere.getDisplayList());
  </code></pre>
  
  <p>To:</p>
  
  <pre><code>glActiveTextureARB(GL_TEXTURE0_ARB);
  glCallList(SkySphere.getDisplayList());
  </code></pre>
  
  <p>displays the proper image once, first cycle, then, white again.</p>
  
  <pre><code>    glBindTexture(GL_TEXTURE_2D, 0);
      glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fboId);
  
      glViewport(0,0,screenWidth,screenHeight);
      glMatrixMode(GL_PROJECTION);
      glLoadIdentity();
      gluPerspective(90.0f, ((float)screenWidth/(float)screenHeight),0.1f,100.0f);
      glMatrixMode(GL_MODELVIEW);
      glLoadIdentity();
      glShadeModel(GL_SMOOTH);
      glHint(GL_PERSPECTIVE_CORRECTION_HINT,
          GL_NICEST);
      glDisable(GL_DEPTH_TEST);
      glClearColor(1.0f,1.0f,0.0f,1.0f);
      glClear (GL_COLOR_BUFFER_BIT);
  
      glLoadIdentity (); 
  
      camera.look();
      glEnable(GL_TEXTURE_2D);
      glDisable(GL_LIGHTING);
  
      glActiveTextureARB(GL_TEXTURE6_ARB);
      glCallList(SkySphere.getDisplayList());
  
      glDisable(GL_TEXTURE_2D);
  
      glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
  </code></pre>
  
  <p>This is the skysphere code:</p>
  
  <pre><code>public static int loadTexture(String filename) {
          ByteBuffer buf = null;
          int tWidth = 0;
          int tHeight = 0;
  
          .. load png into buffer..
  
          // Create a new texture object in memory and bind it
          textureId = GL11.glGenTextures();
          GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureId);
  
          // 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);          
          // Setup what to do when the texture has to be scaled
          GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, 
                          GL11.GL_NEAREST);
          GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, 
                          GL11.GL_LINEAR);
  
  
          return textureId;
  }
  
  public static int getDisplayList() {
      return displayList;
  }
  
  public static int makeSphere() {
      Sphere s = new Sphere();       // an LWJGL class for drawing sphere
      s.setOrientation(GLU.GLU_INSIDE);  // normals point inwards
      s.setTextureFlag(true);           // generate texture coords
      displayList = GL11.glGenLists(1);
      GL11.glNewList(displayList, GL11.GL_COMPILE);
      {
          GL11.glPushMatrix();
          {
                      GL11.glBindTexture(GL11.GL_TEXTURE_2D, getTextureId());
              //GL11.glTranslatef(0,0,0);
              GL11.glRotatef(90f, 1,0,0);     // rotate the sphere to align the axis vertically
              s.draw(1, 48, 48);              // run GL commands to draw sphere
          }
          GL11.glPopMatrix();
      }
      GL11.glEndList();
      return displayList;
  }
  </code></pre>
  
  <p>In initGL:</p>
  
  <pre><code>    SkySphere.createShader();
      SkySphere.loadTexture("textures/panorama2.png");
      SkySphere.makeSphere();
  </code></pre>
  
  <p>Also I'm doing most of my work in framebuffers:</p>
  
  <pre><code>    glBindTexture(GL_TEXTURE_2D, 0);
      glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, modelsFboId);
  </code></pre>
  
  <p>And in one occasion copy the depth to a texture:</p>
  
  <pre><code>    glActiveTextureARB(GL_TEXTURE3_ARB);
      glBindTexture(GL_TEXTURE_2D, modelsDepthTextureId);
      glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, screenWidth, screenHeight);
      glBindTexture(GL_TEXTURE_2D, 0);
  
      glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);    
  </code></pre>