1

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!

4

1 に答える 1

3

デフォルトのテクスチャ パラメータには、完全なミップマップ セットが必要です。

GL_NEARESTまたはGL_LINEARを使用してみてくださいGL_TEXTURE_MIN_FILTER

2 の累乗のテクスチャ ディメンションも必要になる場合があります。

于 2011-10-05T22:45:37.723 に答える