summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrey Konovalov <andrey.konovalov@linaro.org>2021-06-22 16:46:50 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-06-30 04:08:10 +0300
commite4be72d0ca1099173869e4aa1b9604773dcae7b8 (patch)
tree09df1bdc2f6365ab01e640b8d9e2466f4fb381e9 /src
parentbabb5a4c8b6838d4b310070e7c38cdfc9610c81e (diff)
qcam: viewfinder_gl: Set the vertex shader file name in selectFormat()
In preparation to extend the supported formats, make it possible to use different vertex fragment files depending on the format. Make "identity.vert" the default choice. Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src')
-rw-r--r--src/qcam/viewfinder_gl.cpp5
-rw-r--r--src/qcam/viewfinder_gl.h1
2 files changed, 5 insertions, 1 deletions
diff --git a/src/qcam/viewfinder_gl.cpp b/src/qcam/viewfinder_gl.cpp
index a6aa2b44..6d1d80bd 100644
--- a/src/qcam/viewfinder_gl.cpp
+++ b/src/qcam/viewfinder_gl.cpp
@@ -131,6 +131,9 @@ bool ViewFinderGL::selectFormat(const libcamera::PixelFormat &format)
/* Set min/mag filters to GL_LINEAR by default. */
textureMinMagFilters_ = GL_LINEAR;
+ /* Use identity.vert as the default vertex shader. */
+ vertexShaderFile_ = ":identity.vert";
+
fragmentShaderDefines_.clear();
switch (format) {
@@ -292,7 +295,7 @@ bool ViewFinderGL::createVertexShader()
vertexShader_ = std::make_unique<QOpenGLShader>(QOpenGLShader::Vertex, this);
/* Compile the vertex shader */
- if (!vertexShader_->compileSourceFile(":identity.vert")) {
+ if (!vertexShader_->compileSourceFile(vertexShaderFile_)) {
qWarning() << "[ViewFinderGL]:" << vertexShader_->log();
return false;
}
diff --git a/src/qcam/viewfinder_gl.h b/src/qcam/viewfinder_gl.h
index 508155b1..bce94c87 100644
--- a/src/qcam/viewfinder_gl.h
+++ b/src/qcam/viewfinder_gl.h
@@ -73,6 +73,7 @@ private:
QOpenGLShaderProgram shaderProgram_;
std::unique_ptr<QOpenGLShader> vertexShader_;
std::unique_ptr<QOpenGLShader> fragmentShader_;
+ QString vertexShaderFile_;
QString fragmentShaderFile_;
QStringList fragmentShaderDefines_;