title: ffmpeg to opengl texture with glTexImage2D
body: <p>I'm trying to make a player in OpenGL. I use ffmpeg to decode the video.</p>
  
  <p>I searched several tutorial (StackOverflow, ....) how to convert my pFrameRGB-> data [0] texture in OpenGL, but it still shows me a white square. I converted my video to 512x256 to comply with 2 ^ n.</p>
  
  <p>I know my pFrameRGB is correct because I can create frameX.ppm with "SaveFrame (...)" function.</p>
  
  <p>I used the following source ( <a href="https://github.com/arashafiei/dranger-ffmpeg-tuto/blob/master/tutorial02.c" rel="nofollow">https://github.com/arashafiei/dranger-ffmpeg-tuto/blob/master/tutorial02.c</a> ) code as a model by adapting for my player.</p>
  
  <p>And this is my source code:</p>
  
  <p><a href="http://www.sourcepod.com/uagkel22-19078" rel="nofollow">http://www.sourcepod.com/uagkel22-19078</a></p>
  
  <p>Does one of you have a solution to my problem?</p>
  
  <p><strong>Edit 1:</strong></p>
  
  <p>I delete:</p>
  
  <pre><code>glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
  glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
  
  glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, 1 ? GL_REPEAT : GL_CLAMP );
  glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, 1 ? GL_REPEAT : GL_CLAMP );
  </code></pre>
  
  <p>And replaced:</p>
  
  <pre><code>glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, pCodecCtx-&gt;width, pCodecCtx-&gt;height, 0, GL_RGB, GL_UNSIGNED_BYTE, pFrameRGB-&gt;data[0]);
  </code></pre>
  
  <p>by:</p>
  
  <pre><code>if(firstRendering){
  glBindTexture(GL_TEXTURE_2D, texture);
  glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, pCodecCtx-&gt;width, pCodecCtx-&gt;height, 0, GL_RGB, GL_UNSIGNED_BYTE, pFrameRGB-&gt;data[0]);
  
  firstRendering = 0;
  
  }else{
  
  glActiveTexture(texture);
  glBindTexture(GL_TEXTURE_2D, texture);
  glTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, pCodecCtx-&gt;width, pCodecCtx-&gt;height, GL_RGB, GL_UNSIGNED_BYTE, pFrameRGB-&gt;data[0]);
  }
  </code></pre>
  
  <p>And i try to run but stiil nothing...</p>