I'm trying to make a player in OpenGL. I use ffmpeg to decode the video.
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.
I know my pFrameRGB is correct because I can create frameX.ppm with "SaveFrame (...)" function.
I used the following source ( https://github.com/arashafiei/dranger-ffmpeg-tuto/blob/master/tutorial02.c ) code as a model by adapting for my player.
And this is my source code:
http://www.sourcepod.com/uagkel22-19078
Does one of you have a solution to my problem?
Edit 1:
I delete:
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 );
And replaced:
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, pCodecCtx->width, pCodecCtx->height, 0, GL_RGB, GL_UNSIGNED_BYTE, pFrameRGB->data[0]);
by:
if(firstRendering){
glBindTexture(GL_TEXTURE_2D, texture);
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, pCodecCtx->width, pCodecCtx->height, 0, GL_RGB, GL_UNSIGNED_BYTE, pFrameRGB->data[0]);
firstRendering = 0;
}else{
glActiveTexture(texture);
glBindTexture(GL_TEXTURE_2D, texture);
glTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, pCodecCtx->width, pCodecCtx->height, GL_RGB, GL_UNSIGNED_BYTE, pFrameRGB->data[0]);
}
And i try to run but stiil nothing...