summaryrefslogtreecommitdiff
path: root/src/qcam/viewfinder_gl.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/qcam/viewfinder_gl.h')
-rw-r--r--src/qcam/viewfinder_gl.h41
1 files changed, 25 insertions, 16 deletions
diff --git a/src/qcam/viewfinder_gl.h b/src/qcam/viewfinder_gl.h
index 69502b7a..4a0f8ca5 100644
--- a/src/qcam/viewfinder_gl.h
+++ b/src/qcam/viewfinder_gl.h
@@ -8,6 +8,9 @@
#ifndef __VIEWFINDER_GL_H__
#define __VIEWFINDER_GL_H__
+#include <array>
+#include <memory>
+
#include <QImage>
#include <QMutex>
#include <QOpenGLBuffer>
@@ -18,8 +21,8 @@
#include <QOpenGLWidget>
#include <QSize>
-#include <libcamera/buffer.h>
#include <libcamera/formats.h>
+#include <libcamera/framebuffer.h>
#include "viewfinder.h"
@@ -53,7 +56,7 @@ protected:
private:
bool selectFormat(const libcamera::PixelFormat &format);
- void configureTexture(unsigned int id);
+ void configureTexture(QOpenGLTexture &texture);
bool createFragmentShader();
bool createVertexShader();
void removeShader();
@@ -63,33 +66,39 @@ private:
libcamera::FrameBuffer *buffer_;
libcamera::PixelFormat format_;
QSize size_;
- unsigned char *yuvData_;
+ unsigned int stride_;
+ unsigned char *data_;
- /* OpenGL components for rendering */
- QOpenGLShader *fragmentShader_;
- QOpenGLShader *vertexShader_;
+ /* Shaders */
QOpenGLShaderProgram shaderProgram_;
+ std::unique_ptr<QOpenGLShader> vertexShader_;
+ std::unique_ptr<QOpenGLShader> fragmentShader_;
+ QString vertexShaderFile_;
+ QString fragmentShaderFile_;
+ QStringList fragmentShaderDefines_;
/* Vertex buffer */
QOpenGLBuffer vertexBuffer_;
- /* Fragment and Vertex shader file name */
- QString fragmentShaderSrc_;
- QString vertexShaderSrc_;
+ /* Textures */
+ std::array<std::unique_ptr<QOpenGLTexture>, 3> textures_;
+
+ /* Common texture parameters */
+ GLuint textureMinMagFilters_;
- /* YUV texture planars and parameters */
- GLuint id_u_;
- GLuint id_v_;
- GLuint id_y_;
+ /* YUV texture parameters */
GLuint textureUniformU_;
GLuint textureUniformV_;
GLuint textureUniformY_;
- QOpenGLTexture textureU_;
- QOpenGLTexture textureV_;
- QOpenGLTexture textureY_;
+ GLuint textureUniformStep_;
unsigned int horzSubSample_;
unsigned int vertSubSample_;
+ /* Raw Bayer texture parameters */
+ GLuint textureUniformSize_;
+ GLuint textureUniformBayerFirstRed_;
+ QPointF firstRed_;
+
QMutex mutex_; /* Prevent concurrent access to image_ */
};