title: Android, Open GL ES, crop and scale texture
body: <p>I have some troubles with video processing. I'm using Surface with Texture to process video with MediaCodec and MediaMuxer (decode, crop, encode with lower quality).<br>
  And on middle-step, which is cropping, I've got problems. Basically, what I want to do is to take lesser dimension of video, then, based on this side, define offsets for bigger side and crop it out. Then result should be properly scaled into 640x640 square. I searched for pretty big amount of time, but all information that I have found points that Open GL should scale image itself. Yes, I should admit that it's doing some scale, but result is looking very ugly it seems to be "compressed" verticaly quite hardly.<br>
  So, now the question itself. Can somebody provide to me some explanation or maybe even snipet of code that perfrom desired functions in Open GL ES?<br>
  I already tried to adjust Viewport thought.  </p>
  
  <pre><code>GLES20.glViewport(0, 0, 640, 640)  
  </code></pre>
  
  <p><strong>UPDATE</strong><br>
  Idea that Isogen74 have proposed more less worked for me. It's still stretched quite significantly, but it's better then nothing.<br>
  Here you can find updated code: <a href="http://pastebin.com/UhTNpPVJ" rel="nofollow">OpenGL setup</a></p>