title: Image is displaying in inverse order and scaling down to half size cocos2d
body: <p>I am drawing image in cocos2d using opengl call but image is displaying in inverse order and scaled down,original size of image is 320*480. i faced same problem previously that time i used to change value of CC_TEXTURE_NPOT_SUPPORT to 1 from 0 in ccConfig file from cocos2d api v1 then it displayed image properly now i am creating new cocos2d project here i am facing same issue, i followed procedure which i used previously but still image is displaying inverse order only what wrong is going i dont know...</p>
  
  <p>screen shot of output</p>
  
  <p><img src="https://i.stack.imgur.com/OwGmN.png" alt="Output image"></p>
  
  <p>Here is my code.....</p>
  
  <p>Code in init method</p>
  
  <pre><code>    if( (self=[super init])) {
  [CCTexture2D setDefaultAlphaPixelFormat:kCCTexture2DPixelFormat_RGBA8888];
  if (originalImage!=nil) {
      originalImage=nil;
  }
  self.originalImage=[Utilities scaleAndRotateImage:[UIImage imageNamed:@"2.jpg"]];
  
  texture2D = [[CCTexture2D alloc] initWithImage:originalImage];
  NSLog(@"Width %f Height %f",texture2D.contentSize.width,texture2D.contentSize.height);
  [self body_init];
  self.isTouchEnabled = YES;
  </code></pre>
  
  <p>/* Draw the next frame of animation. */</p>
  
  <pre><code>- (void)body_redraw {
  int k;
  int i, j;
  if(mass == NULL) {
  NSLog(@"mass is null");
  return;
  }
  glBindTexture(GL_TEXTURE_2D, [texture2D name]);
  
  k = 0;
  for (i = 0; i &lt; GRID_SIZE_X - 1; i++)
  {
  for (j = 0; j &lt; GRID_SIZE_Y - 1; j++)
  {
      GLfloat vertices[]= {
          mass[k].x[0],mass[k].x[1],mass[k].x[2],
          mass[k + 1].x[0],mass[k + 1].x[1],mass[k + 1].x[2],
          mass[k + GRID_SIZE_Y + 1].x[0],mass[k + GRID_SIZE_Y + 1].x[1],
               mass[k + GRID_SIZE_Y + 1].x[2],
          mass[k + GRID_SIZE_Y].x[0],mass[k + GRID_SIZE_Y].x[1],
           mass[k + GRID_SIZE_Y].x[2]
      };
      GLfloat tex[]={
          mass[k].t[0], mass[k].t[1],
          mass[k + 1].t[0], mass[k + 1].t[1],
          mass[k + GRID_SIZE_Y + 1].t[0], mass[k + GRID_SIZE_Y + 1].t[1],
          mass[k + GRID_SIZE_Y].t[0], mass[k + GRID_SIZE_Y].t[1]
      };
  
      glVertexPointer(3, GL_FLOAT, 0, vertices);
      glTexCoordPointer(2, GL_FLOAT, 0, tex);
      glDrawArrays(GL_TRIANGLE_FAN, 0,4);
  
      k++;
   }
    k++;
  }
  }
  
  
  - (void)body_init {
  
   GLint width = texture2D.contentSizeInPixels.width;
   GLint height = texture2D.contentSizeInPixels.height;
   int i, j;
   int k;
  
   if (mass == NULL)
  {
  mass = (MASS *) malloc(sizeof(MASS)*GRID_SIZE_X*GRID_SIZE_Y);
  if (mass == NULL)
  {
      fprintf(stderr, "body: Can't allocate memory.\n");
      exit(-1);
  }
  }
  
  k = 0;
  for (i = 0; i &lt; GRID_SIZE_X; i++)
  for (j = 0; j &lt; GRID_SIZE_Y; j++)
  {
      //this code implements grid on texture2D, gets vertex &amp; side vertex in array
      mass[k].nail = (i == 0 || j == 0 || i == GRID_SIZE_X - 1
                      || j == GRID_SIZE_Y - 1);//value is 0/1
  
      mass[k].x[0] = i/(GRID_SIZE_X - 1.0)*width;
      //            NSLog(@"mass[%d].x[0]:: %f",k,mass[k].x[0]);
  
      mass[k].x[1] = j/(GRID_SIZE_Y - 1.0)*height;
      //            NSLog(@"mass[%d].x[1]:: %f",k,mass[k].x[1]);
  
      mass[k].x[2] = -(CLIP_FAR - CLIP_NEAR)/4.0;
      //            NSLog(@"mass[%d].x[2]:: %f",k,mass[k].x[2]);
  
      mass[k].v[0] = 0.0;
      mass[k].v[1] = 0.0;
      mass[k].v[2] = 0.0;
  
      mass[k].t[0] = i/(GRID_SIZE_X - 1.0);
      mass[k].t[1] = j/(GRID_SIZE_Y - 1.0);
  
      k++;
    }
  }
  
  - (void)draw {
  
  glDisableClientState(GL_COLOR_ARRAY);
  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
  glColor4ub(224,224,244,200);
  
  [self body_redraw];
  
  glBlendFunc(CC_BLEND_SRC, CC_BLEND_DST);
  glEnableClientState(GL_COLOR_ARRAY);
  </code></pre>
  
  <p>}</p>