mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-19 18:35:07 +03:00
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>
This commit is contained in:
parent
babb5a4c8b
commit
e4be72d0ca
2 changed files with 5 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -73,6 +73,7 @@ private:
|
|||
QOpenGLShaderProgram shaderProgram_;
|
||||
std::unique_ptr<QOpenGLShader> vertexShader_;
|
||||
std::unique_ptr<QOpenGLShader> fragmentShader_;
|
||||
QString vertexShaderFile_;
|
||||
QString fragmentShaderFile_;
|
||||
QStringList fragmentShaderDefines_;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue