inout_format.color_space = COLORSPACE_sRGB;
inout_format.gamma_curve = GAMMA_sRGB;
- chain.add_input(inout_format);
+ Input *input = chain.add_input(inout_format);
Effect *lift_gamma_gain_effect = chain.add_effect(EFFECT_LIFT_GAMMA_GAIN);
Effect *saturation_effect = chain.add_effect(EFFECT_SATURATION);
Effect *diffusion_effect = chain.add_effect(EFFECT_DIFFUSION);
chain.add_output(inout_format);
chain.finalize();
- // generate a PDO to hold the data we read back with glReadPixels()
- // (Intel/DRI goes into a slow path if we don't read to PDO)
- glBindBuffer(GL_PIXEL_PACK_BUFFER_ARB, 1);
+ // generate a PBO to hold the data we read back with glReadPixels()
+ // (Intel/DRI goes into a slow path if we don't read to PBO)
+ GLuint pbo;
+ glGenBuffers(1, &pbo);
+ glBindBuffer(GL_PIXEL_PACK_BUFFER_ARB, pbo);
glBufferData(GL_PIXEL_PACK_BUFFER_ARB, WIDTH * HEIGHT * 4, NULL, GL_STREAM_READ);
make_hsv_wheel_texture();
diffusion_effect->set_float("radius", blur_radius);
diffusion_effect->set_float("blurred_mix_amount", blurred_mix_amount);
- chain.render_to_screen(src_img);
+ input->set_pixel_data(src_img);
+ chain.render_to_screen();
- glBindBuffer(GL_PIXEL_PACK_BUFFER_ARB, 1);
+ glBindBuffer(GL_PIXEL_PACK_BUFFER_ARB, pbo);
check_error();
glReadPixels(0, 0, WIDTH, HEIGHT, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, BUFFER_OFFSET(0));
check_error();
SDL_GL_SwapBuffers();
check_error();
- glBindBuffer(GL_PIXEL_PACK_BUFFER_ARB, 1);
+ glBindBuffer(GL_PIXEL_PACK_BUFFER_ARB, pbo);
check_error();
unsigned char *screenbuf = (unsigned char *)glMapBuffer(GL_PIXEL_PACK_BUFFER_ARB, GL_READ_ONLY);
check_error();