I want to use OpenGL to play video, and the I try to create glTexImage2D texture and update using glTexSubImage2D.
but this way is too slow to run when I play 1080P video, so I find FBO can do it faster, but I don't know how to use it to render texture.
I use OpenCV getting video every frame ,this is some parts of my code:

init function:
Code :
                // Generate a new texture
		glGenTextures(1, &textureID);
 
		// Bind the texture to a name
		glBindTexture(GL_TEXTURE_2D, textureID);
 
		// Set texture clamping method
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
 
		// Set texture interpolation method to use linear interpolation (no MIPMAPS)
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
 
		// Specify the texture specification
		glTexImage2D(GL_TEXTURE_2D, 				// Type of texture
					 0,				// Pyramid level (for mip-mapping) - 0 is the top level
					 3,	                 // Image colour depth
					 1920,	// Image width
					 1080,	// Image height
					 0,				// Border width in pixels (can either be 1 or 0)
					 GL_RGB,	// Image format (i.e. RGB, RGBA, BGR etc.)
					 GL_UNSIGNED_BYTE,		// Image data type
					 NULL);			// The actual image data itself
 
                // setup FBO			
		glGenFramebuffers( 1, &FFrameBuffer );
		glBindFramebuffer( GL_FRAMEBUFFER, FFrameBuffer );
		glFramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textureID, 0 );
		GLenum DrawBuffers[1] = {GL_COLOR_ATTACHMENT0};
		glDrawBuffers(1, DrawBuffers); // "1" is the size of DrawBuffers		
		glBindFramebuffer( GL_FRAMEBUFFER, 0 );	
 
                //create video
                capture = cvCreateFileCapture(HDFileName);


update function:
Code :
                        if(cvGrabFrame(capture))
			{
 
				IplImage *frame = cvQueryFrame(capture);					
				cvFlip(frame, NULL, -1);
 
				GLubyte *texture_data = (unsigned char*)frame->imageData;	
 
		                glBindFramebuffer( GL_FRAMEBUFFER, FFrameBuffer );
 
                                //how to write GLubyte data to Framebuffer?
 
                                glBindFramebuffer( GL_FRAMEBUFFER, 0 );
 
			}