title: glTexImage2D giving GL_INVALID_VALUE because width or height cannot be represented as 2k + 2
body: <p>I have a screenshot taken from the first opengl canvas which i need to draw in the second opengl canvas. I have taken the screenshot using <code>glReadPixels</code>:</p>
  
  <pre><code>glReadPixels(posx, posy, pageWidth , pageHeight, GL_RGB, GL_UNSIGNED_BYTE, data);
  </code></pre>
  
  <p>The first opengl canvas has two or more images with some lines and text data around it. I am using the second opengl canvas to show the tiling of the images with the surrounding data as a whole.I do not want to redraw the same in the second opengl canvas and hence want to take a screenshot and draw the tiling part of the screenshot in the second canvas. </p>
  
  <p>I also have saved the snapshot taken in to a jpg file which is coming perfectly.</p>
  
  <p>But the problem comes when I need to draw the pixel data using glTexImage2d as the pageWidth or pageHeight used cannot be represented as 2K+ 2. Hence the error is coming as <code>GL_INVALID_VALUE</code>.</p>
  
  <pre><code>glTexImage2D (GL_TEXTURE_2D, 0, imgSamplesPerPixel), 
      pageWidth,  pageHeight, 0,SamplesPerPixel, GL_UNSIGNED_BYTE, data);
  </code></pre>
  
  <p>The pageWidth and pageHeight can be of any value (lesser than the <code>GL_MAX_TEXTURE_SIZE</code>), for example 240 X 600. So how should I solve this problem ?</p>