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

This commit is contained in:
Ronan Abhamon 2017-03-22 09:38:18 +01:00
parent e639983177
commit afba34e03a
2 changed files with 9 additions and 28 deletions

View file

@ -31,30 +31,10 @@
#include <QThread>
#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 {
GLuint width;
GLuint height;
@ -74,7 +54,6 @@ CameraRenderer::~CameraRenderer () {
QOpenGLFramebufferObject *CameraRenderer::createFramebufferObject (const QSize &size) {
QOpenGLFramebufferObjectFormat format;
format.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
format.setInternalTextureFormat(GL_RGBA8);
format.setSamples(4);
@ -94,8 +73,6 @@ QOpenGLFramebufferObject *CameraRenderer::createFramebufferObject (const QSize &
}
void CameraRenderer::render () {
CameraStateBinder state;
if (!m_linphone_call)
return;
@ -161,9 +138,14 @@ Camera::Camera (QQuickItem *parent) : QQuickFramebufferObject(parent) {
setMirrorVertically(true);
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();
}

View file

@ -35,7 +35,6 @@ struct ContextInfo;
class CameraRenderer : public QQuickFramebufferObject::Renderer {
friend class Camera;
friend struct CameraStateBinder;
public:
CameraRenderer ();