我与 Vuforia 合作开展一个项目。我使用Vuforia的VideoPlayback示例。
当 Vuforia 检测到标记时,会在该标记上播放视频。我尝试在视频叠加层上应用色键。我发现这篇文章http://pilcrowpipe.blogspot.fr/2013/03/chroma-keying-transparent-background.html
我尝试实现代码,但没有任何效果。我认为这个例子使用了 chromakey 的视频背景,但我想要覆盖视频上的 chromakey。我对吗 ?
在 Vuforia Sample 中,我想我必须在renderFrameWithState函数中进行一些更改。
if (NOT_READY != currentStatus) {
// Convert trackable pose to matrix for use with OpenGL
// ...
/// TEST doesn't work
//glDepthFunc(GL_LEQUAL);
//glEnable(GL_BLEND);
//glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
///
// ...
glUseProgram(shaderProgramID);
glVertexAttribPointer(vertexHandle, 3, GL_FLOAT, GL_FALSE, 0, quadVertices);
glVertexAttribPointer(normalHandle, 3, GL_FLOAT, GL_FALSE, 0, quadNormals);
glVertexAttribPointer(textureCoordHandle, 2, GL_FLOAT, GL_FALSE, 0, texCoords);
glEnableVertexAttribArray(vertexHandle);
glEnableVertexAttribArray(normalHandle);
glEnableVertexAttribArray(textureCoordHandle);
// I think I must change something in code above...
// But what and where ????
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, frameTextureID);
glUniformMatrix4fv(mvpMatrixHandle, 1, GL_FALSE, (GLfloat*)&modelViewProjectionVideo.data[0]);
glUniform1i(texSampler2DHandle, 0 /*GL_TEXTURE0*/);
glDrawElements(GL_TRIANGLES, kNumQuadIndices, GL_UNSIGNED_SHORT, quadIndices);
glDisableVertexAttribArray(vertexHandle);
glDisableVertexAttribArray(normalHandle);
glDisableVertexAttribArray(textureCoordHandle);
glUseProgram(0);
}
我对 OpenGL ES 完全不熟悉。
任何人都可以帮助我吗?
谢谢