Skip to content

Commit

Permalink
example: implement intermediate fbo for filtering rgb texture
Browse files Browse the repository at this point in the history
  • Loading branch information
wang-bin committed Sep 21, 2017
1 parent b963adc commit dff05bb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions examples/player/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 111,7 @@ MainWindow::MainWindow(QWidget *parent) :
, mpSubtitle(0)
, m_preview(0)
, m_shader(NULL)
, m_glsl(NULL)
{
#if defined(Q_OS_MACX) && QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
QApplication::setStyle(QStyleFactory::create("Fusion"));
Expand Down Expand Up @@ -549,6 550,7 @@ void MainWindow::setupUi()
connect(mpTimeSlider, SIGNAL(onLeave()), SLOT(onTimeSliderLeave()));
connect(mpTimeSlider, SIGNAL(onHover(int,int)), SLOT(onTimeSliderHover(int,int)));
connect(&Config::instance(), SIGNAL(userShaderEnabledChanged()), SLOT(onUserShaderChanged()));
connect(&Config::instance(), SIGNAL(intermediateFBOChanged()), SLOT(onUserShaderChanged()));
connect(&Config::instance(), SIGNAL(fragHeaderChanged()), SLOT(onUserShaderChanged()));
connect(&Config::instance(), SIGNAL(fragSampleChanged()), SLOT(onUserShaderChanged()));
connect(&Config::instance(), SIGNAL(fragPostProcessChanged()), SLOT(onUserShaderChanged()));
Expand Down Expand Up @@ -1543,6 1545,14 @@ void MainWindow::onUserShaderChanged()
return;
#ifndef QT_NO_OPENGL
if (Config::instance().userShaderEnabled()) {
if (Config::instance().intermediateFBO()) {
if (!m_glsl)
m_glsl = new GLSLFilter(this);
m_glsl->installTo(mpRenderer);
} else {
if (m_glsl)
m_glsl->uninstall();
}
if (!m_shader)
m_shader = new DynamicShaderObject(this);
m_shader->setHeader(Config::instance().fragHeader());
Expand Down
2 changes: 2 additions & 0 deletions examples/player/MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 39,7 @@ class LibAVFilterVideo;
class SubtitleFilter;
class VideoPreviewWidget;
class DynamicShaderObject;
class GLSLFilter;
}
QT_BEGIN_NAMESPACE
class QMenu;
Expand Down Expand Up @@ -213,6 214,7 @@ private slots:
QtAV::SubtitleFilter *mpSubtitle;
QtAV::VideoPreviewWidget *m_preview;
QtAV::DynamicShaderObject *m_shader;
QtAV::GLSLFilter *m_glsl;
};


Expand Down

0 comments on commit dff05bb

Please sign in to comment.