glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * 12, vertices, GL_DYNAMIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, background_texture_vbo_);
glEnableVertexAttribArray(background_texture_location_);
glVertexAttribPointer(background_texture_location_, 2, GL_FLOAT, GL_FALSE, 0, 0);
switch (background_shader_) {
case FrameShader_RGB:
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, background_texture_id_);
break;
case FrameShader_YUV:
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, background_texture_id_);
if (current_format_ == easyar_PixelFormat_YUV_NV21 || current_format_ == easyar_PixelFormat_YUV_NV12) {
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, background_texture_uv_id_);
} else {
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, background_texture_u_id_);
glActiveTexture(GL_TEXTURE2);
glBindTexture(GL_TEXTURE_2D, background_texture_v_id_);
}
break;
}
// NSLog(@"GL_TRIANGLE_FAN",glDrawArrays(GL_TRIANGLE_FAN, 0, 4));
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);