0

FBO を使用して QuickTime ムービーの画像を表示したいアプリケーションがあります。私は FBO にまったく慣れておらず、OpenGL について少ししか知識がありません。テクスチャなどをバインドする FBO パラダイムを理解するのに問題がありました。皆さんが助けてくれることを願っています。

映画の現在の画像を取得するために、私は使用しています

QTVisualContextCopyImageForTime(theContext, NULL, NULL, &currentFrameTex);currentFrameTexCVImageBufferRef です。

FBO を設定するために、私が行っていることは次のとおりです。

glGenFramebuffersEXT(1, &idFrameBuf);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, idFrameBuf);

次のコードを使用して画像を描画しています。

// get the texture target (for example, GL_TEXTURE_2D) of the texture
GLint target = CVOpenGLTextureGetTarget(currentFrameTex);
// get the texture target name of the texture
GLint texID = CVOpenGLTextureGetName(currentFrameTex);

// get the texture coordinates for the part of the image that should be displayed
CVOpenGLTextureGetCleanTexCoords(currentFrameTex,
                                 bottomLeft, bottomRight,
                                 topRight, topLeft);
glBindTexture(target, texID);
glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(target, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);

glTexImage2D(target, 0, GL_RGBA8, 256, 256, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL);
glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, target, texID, 0);

黒い画像が表示されるだけで、何が間違っているのかわかりません。必要に応じて、より多くの情報を提供できます。前もって感謝します!

4

1 に答える 1

1

http://www.opengl.org/wiki/Framebuffer_Objectを参照してください。FBO を使用すると、グラフィックをオフスクリーン バッファにレンダリングしてから処理できます。あなたのコードは currentFrameTex によって提供されるテクスチャを上書きしますが、これはあまり意味がありません。0 以外の idFrameBuf で glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, idFrameBuf) を呼び出すと、すべてのグラフィックがこの FBO に描画され、画面には何も描画されません。

于 2013-02-16T19:58:24.670 に答える