Commit afba34e0 authored by Ronan Abhamon's avatar Ronan Abhamon

feat(src/components/camera/Camera): remove useless code

parent e6399831
...@@ -31,29 +31,9 @@ ...@@ -31,29 +31,9 @@
#include <QThread> #include <QThread>
#include <QTimer> #include <QTimer>
// ============================================================================= #define MAX_FPS 30
struct CameraStateBinder {
CameraStateBinder () {
QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions();
f->glEnable(GL_DEPTH_TEST);
f->glEnable(GL_CULL_FACE);
f->glDepthMask(GL_TRUE);
f->glDepthFunc(GL_LESS);
f->glFrontFace(GL_CCW);
f->glCullFace(GL_BACK);
}
~CameraStateBinder () {
QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions();
f->glDisable(GL_CULL_FACE); // =============================================================================
f->glDisable(GL_DEPTH_TEST);
}
};
// -----------------------------------------------------------------------------
struct ContextInfo { struct ContextInfo {
GLuint width; GLuint width;
...@@ -74,7 +54,6 @@ CameraRenderer::~CameraRenderer () { ...@@ -74,7 +54,6 @@ CameraRenderer::~CameraRenderer () {
QOpenGLFramebufferObject *CameraRenderer::createFramebufferObject (const QSize &size) { QOpenGLFramebufferObject *CameraRenderer::createFramebufferObject (const QSize &size) {
QOpenGLFramebufferObjectFormat format; QOpenGLFramebufferObjectFormat format;
format.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
format.setInternalTextureFormat(GL_RGBA8); format.setInternalTextureFormat(GL_RGBA8);
format.setSamples(4); format.setSamples(4);
...@@ -94,8 +73,6 @@ QOpenGLFramebufferObject *CameraRenderer::createFramebufferObject (const QSize & ...@@ -94,8 +73,6 @@ QOpenGLFramebufferObject *CameraRenderer::createFramebufferObject (const QSize &
} }
void CameraRenderer::render () { void CameraRenderer::render () {
CameraStateBinder state;
if (!m_linphone_call) if (!m_linphone_call)
return; return;
...@@ -161,9 +138,14 @@ Camera::Camera (QQuickItem *parent) : QQuickFramebufferObject(parent) { ...@@ -161,9 +138,14 @@ Camera::Camera (QQuickItem *parent) : QQuickFramebufferObject(parent) {
setMirrorVertically(true); setMirrorVertically(true);
m_refresh_timer = new QTimer(this); m_refresh_timer = new QTimer(this);
m_refresh_timer->setInterval(1 / 30 * 1000); m_refresh_timer->setInterval(1 / MAX_FPS * 1000);
QObject::connect(
m_refresh_timer, &QTimer::timeout,
this, &QQuickFramebufferObject::update,
Qt::DirectConnection
);
QObject::connect(m_refresh_timer, &QTimer::timeout, this, &QQuickFramebufferObject::update);
m_refresh_timer->start(); m_refresh_timer->start();
} }
......
...@@ -35,7 +35,6 @@ struct ContextInfo; ...@@ -35,7 +35,6 @@ struct ContextInfo;
class CameraRenderer : public QQuickFramebufferObject::Renderer { class CameraRenderer : public QQuickFramebufferObject::Renderer {
friend class Camera; friend class Camera;
friend struct CameraStateBinder;
public: public:
CameraRenderer (); CameraRenderer ();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment