FBO を使用して QuickTime ムービーの画像を表示したいアプリケーションがあります。私は FBO にまったく慣れておらず、OpenGL について少ししか知識がありません。テクスチャなどをバインドする FBO パラダイムを理解するのに問題がありました。皆さんが助けてくれることを願っています。
映画の現在の画像を取得するために、私は使用しています
QTVisualContextCopyImageForTime(theContext, NULL, NULL, ¤tFrameTex);
はcurrentFrameTex
CVImageBufferRef です。
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);
黒い画像が表示されるだけで、何が間違っているのかわかりません。必要に応じて、より多くの情報を提供できます。前もって感謝します!