44 float fade = 1.0F - (
m_rate / 150.0F);
45 float zoom = 1.0F - (
m_rate / 4000.0F);
46 for (
auto & state :
m_vbos)
48 state.second[1] *= fade;
49 state.second[2] *= zoom;
53 auto vertex =
m_vbos.front();
59 auto & vbo =
m_vbos.back();
60 vbo.second[0] =
m_hue;
68 void* buffer = vbo.first->map(QOpenGLBuffer::WriteOnly);
87 render->glEnableVertexAttribArray(0);
88 QPointF center {
m_area.left() + (
static_cast<qreal
>(
m_area.width()) / 2),
89 m_area.top() + (
static_cast<qreal
>(
m_area.height()) / 2) };
92 for (
auto & vertex :
m_vbos)
95 render->glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0,
nullptr);
106 auto color = QColor::fromHsvF(
static_cast<qreal
>(vertex.second[0]), 1.0, 1.0);
107 render->glVertexAttrib4f(1,
static_cast<GLfloat
>(color.redF()),
108 static_cast<GLfloat
>(color.greenF()),
109 static_cast<GLfloat
>(color.blueF()),
112 render->glDrawArrays(GL_LINE_STRIP, 0,
NUM_SAMPLES);
119 render->glLineWidth(1);
120 QOpenGLBuffer::release(QOpenGLBuffer::VertexBuffer);
121 render->glDisableVertexAttribArray(0);
140 std::array<GLfloat,2> ranges { 1.0 };
141 render->glGetFloatv(GL_ALIASED_LINE_WIDTH_RANGE, ranges.data());
154 int size =
m_fade ? 8 : 1;
155 while (
m_vbos.size() < size)
156 m_vbos.push_back({render->CreateVBO(
NUM_SAMPLES * 2 *
sizeof(GLfloat),
false), {}});
158 if (m_openglShader && m_vbos.size() == size)
void PushTransformation(const UIEffects &Fx, QPointF &Center)
void PopTransformation(void)
void SetShaderProjection(QOpenGLShaderProgram *Program)
MythRenderOpenGL * Initialise(QRect Area)
void Draw(QRect Area, MythPainter *, QPaintDevice *) override
QOpenGLShaderProgram * m_openglShader
MythVisualMonoScopeOpenGL(AudioPlayer *Audio, MythRender *Render, bool Fade)
~MythVisualMonoScopeOpenGL() override
bool UpdateVertices(float *Buffer)
void InitCommon(QRect Area)
static const QString kSimpleVertexShader
static const QString kSimpleFragmentShader
static eu8 clamp(eu8 value, eu8 low, eu8 high)
static constexpr size_t NUM_SAMPLES