title: subclassing CCNode, blitzing image with glTexImage2D
body: <p>I've subclassed CCNode and would like to blitz an image stored in a member GLubyte* buffer on each draw call. This results in a black square being drawn, and a sibling CCLabel node is now also completely black.</p>
  
  <p>So there are two issues:</p>
  
  <ol>
  <li>Why isn't the square white? I'm memset-ing the buffer to 0xffffffff.</li>
  <li>There must be something wrong with my OpenGL calls in the draw method, since it affects the drawing of another node. Can anyone say what?</li>
  </ol>
  
  <p>data initialization:</p>
  
  <pre><code>exponent = e;
  width = 1 &lt;&lt; exponent;
  height = 1 &lt;&lt; exponent;
  imageData = (GLubyte *) calloc(width * height * 4, sizeof(GLubyte));
  memset(imageData, 0xff, 4 * width * height * sizeof(GLubyte));
  </code></pre>
  
  <p>draw method:</p>
  
  <pre><code>- (void) draw
  {
    float w = 100.0f;
  
    GLfloat vertices[] = {
      0.0f, 0.0f, 0.0f,
         w, 0.0f, 0.0f,
      0.0f,    w, 0.0f,
         w,    w, 0.0f
    };
  
    const GLshort texture_coordinates[] = {
      0, 0,
      1, 0,
      0, 1,
      1, 1,
    };
  
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, width, 0, GL_RGBA, GL_UNSIGNED_BYTE, imageData);
  
    glVertexPointer(3, GL_FLOAT, 0, vertices);
    glTexCoordPointer(2, GL_SHORT, 0, texture_coordinates);
  
    glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
  }
  </code></pre>