Question

I have a feeling I'm overlooking something simple here...

I have an AR application that displays a 3D object upon marker detection. The object is simply a flat 3d rectangle - which I am able to bind image textures to without issue. However, I need to bind a video file (.m4v) as the objects texture. I am successfully reading the file with a AVAssetReader, however when binding the texture like so, the object just appears white.

CMSampleBufferRef sampleBuffer = [mOutput copyNextSampleBuffer];
CVImageBufferRef pixelBuffer = CMSampleBufferGetImageBuffer(sampleBuffer);
CVPixelBufferLockBaseAddress( pixelBuffer, 0 );
glBindTexture(GL_TEXTURE_2D, texture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 320, 240, 0, GL_BGRA, GL_UNSIGNED_BYTE, CVPixelBufferGetBaseAddress(pixelBuffer));
CVPixelBufferUnlockBaseAddress( pixelBuffer, 0 );    
CFRelease(sampleBuffer);

I'd appreciate any help you can give. Thanks!

Was it helpful?

Solution

The default texture parameters require a complete set of mipmaps.

Try using GL_NEAREST or GL_LINEAR for GL_TEXTURE_MIN_FILTER.

You may also need power-of-two texture dimensions.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top