Files
oak-editor/app/render/backend/opengl/openglbackend.h
T
itsmattkc 04d39e27a8 copy texture before signalling it
Sending a texture directly from the texture cache is dangerous since once the
reference is relinquished, it could be picked up and used by another thread.
Copying the texture to a separate one takes a little extra time but lets the
viewer remain in control of that texture.
2019-12-21 20:38:15 +11:00

48 lines
1.0 KiB
C++

#ifndef OPENGLBACKEND_H
#define OPENGLBACKEND_H
#include "../videorenderbackend.h"
#include "openglframebuffer.h"
#include "openglworker.h"
#include "opengltexture.h"
#include "opengltexturecache.h"
#include "openglshader.h"
#include "openglshadercache.h"
class OpenGLBackend : public VideoRenderBackend
{
Q_OBJECT
public:
OpenGLBackend(QObject* parent = nullptr);
virtual ~OpenGLBackend() override;
OpenGLTexturePtr GetCachedFrameAsTexture(const rational& time);
protected:
virtual bool InitInternal() override;
virtual void CloseInternal() override;
virtual bool CompileInternal() override;
virtual void DecompileInternal() override;
virtual void EmitCachedFrameReady(const rational& time, const QVariant& value) override;
private:
OpenGLTexturePtr CopyTexture(OpenGLTexturePtr input);
OpenGLShaderCache shader_cache_;
OpenGLTextureCache texture_cache_;
OpenGLTexturePtr master_texture_;
OpenGLFramebuffer copy_buffer_;
OpenGLShaderPtr copy_pipeline_;
};
#endif // OPENGLBACKEND_H