[libcamera-devel] [PATCH][RFC 1/2] qcam: viewfinder_gl: set the vertex shader file name in selectFormat()
Andrey Konovalov
andrey.konovalov at linaro.org
Mon Nov 9 22:34:10 CET 2020
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 at linaro.org>
---
src/qcam/viewfinder_gl.cpp | 4 +++-
src/qcam/viewfinder_gl.h | 1 +
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/qcam/viewfinder_gl.cpp b/src/qcam/viewfinder_gl.cpp
index 5d9b442e..c74ce77b 100644
--- a/src/qcam/viewfinder_gl.cpp
+++ b/src/qcam/viewfinder_gl.cpp
@@ -114,6 +114,8 @@ bool ViewFinderGL::selectFormat(const libcamera::PixelFormat &format)
{
bool ret = true;
+ vertexShaderFile_ = ":identity.vert";
+
fragmentShaderDefines_.clear();
switch (format) {
@@ -219,7 +221,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 150fa4ae..6cf8f347 100644
--- a/src/qcam/viewfinder_gl.h
+++ b/src/qcam/viewfinder_gl.h
@@ -72,6 +72,7 @@ private:
QOpenGLShaderProgram shaderProgram_;
std::unique_ptr<QOpenGLShader> vertexShader_;
std::unique_ptr<QOpenGLShader> fragmentShader_;
+ QString vertexShaderFile_;
QString fragmentShaderFile_;
QStringList fragmentShaderDefines_;
--
2.17.1
More information about the libcamera-devel
mailing list