title: GLKBaseEffect not loading texture (texture appears black on object)
body: <p>I'm using GLKit in an OpenGL project. Everything is based on GLKView and GLKBaseEffect (no custom shaders). In my project I have several views that have GLKViews for showing 3D objects, and occasionally several of those view can be "open" at once (i.e. are in the modal view stack).</p>
  
  <p>While until now everything was working great, in a new view I was creating I needed to have a rectangle with texture to simulate a measuring tape for the 3D world of my app. For some unknown reason, in that view only, the texture isn't loaded right into the opengl context: the texture is loaded right by GLKTextureLoader, but when drawing the rectangle is black, and looking at the OpenGL frame in debug, I can see that an empty texture is loaded (there's a reference to a texture, but it's all zeroed out or null).</p>
  
  <p>The shape I'm drawing is defined by: (it was originally a triangle strip, but I switched for triangles to make sure it's not the issue)</p>
  
  <pre><code>static const GLfloat initTape[] = {
      -TAPE_WIDTH / 2.0f, 0, 0,
      TAPE_WIDTH / 2.0f, 0, 0,
      -TAPE_WIDTH / 2.0f, TAPE_INIT_LENGTH, 0,
  
      TAPE_WIDTH / 2.0f, 0, 0,
      TAPE_WIDTH / 2.0f, TAPE_INIT_LENGTH, 0,
      -TAPE_WIDTH / 2.0f, TAPE_INIT_LENGTH, 0,
  };
  static const GLfloat initTapeTex[] = {
      0, 0,
      1, 0,
      0, 1.0,
  
      1, 0,
      1, 1,
      0, 1,
  };
  </code></pre>
  
  <p>I set the effect variable as:</p>
  
  <pre><code>    effect.transform.modelviewMatrix = modelview;
      effect.light0.enabled = GL_FALSE;
  
      // Projection setup
      GLfloat ratio = self.view.bounds.size.width/self.view.bounds.size.height;
      GLKMatrix4 projection = GLKMatrix4MakePerspective(GLKMathDegreesToRadians(self.fov), ratio, 0.1f, 1000.0f);
      effect.transform.projectionMatrix = projection;
  
  
      // Set the color of the wireframe.
      if (tapeTex == nil) {
          NSError* error;
          tapeTex = [GLKTextureLoader textureWithContentsOfFile:[[[NSBundle mainBundle] URLForResource:@"ruler_texture" withExtension:@"png"] path] options:nil error:&amp;error];
      }
      effect.texture2d0.enabled = GL_TRUE;
      effect.texture2d0.target = GLKTextureTarget2D;
      effect.texture2d0.envMode = GLKTextureEnvModeReplace;
      effect.texture2d0.name = tapeTex.name;
  </code></pre>
  
  <p>And the rendering loop is:</p>
  
  <pre><code>       [effect prepareToDraw];
          glDisable(GL_DEPTH_TEST);
          glDisable(GL_CULL_FACE);
          glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
          glEnable(GL_BLEND);
          glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
          glEnableVertexAttribArray(GLKVertexAttribPosition);
          glEnableVertexAttribArray(GLKVertexAttribTexCoord0);
          glVertexAttribPointer(GLKVertexAttribPosition, COORDS, GL_FLOAT, GL_FALSE, 0, tapeVerts);
          glVertexAttribPointer(GLKVertexAttribTexCoord0, 2, GL_FLOAT, GL_FALSE, 0, tapeTexCoord);
  
          glDrawArrays(GL_TRIANGLES, 0, TAPE_VERTS);
  
          glDisableVertexAttribArray(GLKVertexAttribPosition);
          glDisableVertexAttribArray(GLKVertexAttribTexCoord0);
  </code></pre>
  
  <p>I've also tested the texture itself in another view with other objects and it works fine, so it's not the texture file fault.</p>
  
  <p>Any help would be greatly appreciated, as I'm stuck on this issue for over 3 days.</p>
  
  <p>Update: Also, there are no glErrors during the rendering loop.</p>