- command->input->enable_opengl();
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
- glReadPixels(0, 0, w, h, GL_RGB, GL_UNSIGNED_BYTE,
- command->frame->get_rows()[0]);
- command->frame->flip_vert();
- command->frame->set_opengl_state(VFrame::RAM);
+ command->input->to_texture();
+ command->input->bind_texture(0);
+ command->frame->enable_opengl();
+ command->frame->init_screen();
+ unsigned int shader = BC_CModels::is_yuv(command->input->get_color_model()) ?
+ VFrame::make_shader(0, yuv_to_rgb_frag, 0) : 0;
+ if( shader > 0 ) {
+ glUseProgram(shader);
+ int variable = glGetUniformLocation(shader, "tex");
+ glUniform1i(variable, 0);
+ BC_GL_YUV_TO_RGB(shader);
+ }
+ else
+ glUseProgram(0);
+ command->input->draw_texture(1);
+ command->frame->screen_to_ram();
+ glUseProgram(0);