/*
* CINELERRA
* Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
+ *
*/
#include "bcdisplayinfo.h"
SwapWindow::SwapWindow(SwapMain *plugin)
: PluginClientWindow(plugin,
- 250,
- 170,
- 250,
- 170,
+ 250,
+ 170,
+ 250,
+ 170,
0)
{
this->plugin = plugin;
{
}
-
+
void SwapWindow::create_objects()
{
int x = 10, y = 10;
: PluginVClient(server)
{
reset();
-
+
}
SwapMain::~SwapMain()
{
-
-
+
+
// if(temp) delete temp;
}
}
-const char* SwapMain::plugin_title() { return _("Swap channels"); }
+const char* SwapMain::plugin_title() { return N_("Swap channels"); }
int SwapMain::is_synthesis() { return 1; }
int SwapMain::is_realtime() { return 1; }
void SwapMain::update_gui()
{
- if(thread)
+ if(thread)
{
load_configuration();
thread->window->lock_window();
{
KeyFrame *prev_keyframe;
prev_keyframe = get_prev_keyframe(get_source_position());
-
+
read_data(prev_keyframe);
return 1;
}
{
load_configuration();
- read_frame(frame,
- 0,
- start_position,
+ read_frame(frame,
+ 0,
+ start_position,
frame_rate,
get_use_opengl());
}
- temp = new_temp(frame->get_w(),
- frame->get_h(),
+ temp = new_temp(frame->get_w(),
+ frame->get_h(),
frame->get_color_model());
switch(frame->get_color_model())
SWAP_CHANNELS(unsigned char, 0x80, 0xff, 4);
break;
}
-
-
+
+
return 0;
}
#ifdef HAVE_GL
char output_frag[BCTEXTLEN];
- sprintf(output_frag,
+ sprintf(output_frag,
"uniform sampler2D tex;\n"
"uniform float chroma_offset;\n"
"void main()\n"
COLOR_SWITCH(config.blue, "b");
COLOR_SWITCH(config.alpha, "a");
- strcat(output_frag,
+ strcat(output_frag,
" gl_FragColor = out_color;\n"
"}\n");
get_output()->clear_pbuffer();
get_output()->bind_texture(0);
- unsigned int shader_id = VFrame::make_shader(0,
- output_frag,
- 0);
- glUseProgram(shader_id);
- glUniform1i(glGetUniformLocation(shader_id, "tex"), 0);
- glUniform1f(glGetUniformLocation(shader_id, "chroma_offset"),
- BC_CModels::is_yuv(get_output()->get_color_model()) ? 0.5 : 0.0);
+ unsigned int shader = VFrame::make_shader(0, output_frag, 0);
+ if( shader > 0 ) {
+ glUseProgram(shader);
+ glUniform1i(glGetUniformLocation(shader, "tex"), 0);
+ glUniform1f(glGetUniformLocation(shader, "chroma_offset"),
+ BC_CModels::is_yuv(get_output()->get_color_model()) ? 0.5 : 0.0);
+ }
get_output()->draw_texture();
glUseProgram(0);