created double buffered textures

This commit is contained in:
itsmattkc
2019-08-27 23:45:18 +10:00
parent b9ce02a0ec
commit d76218924e
4 changed files with 114 additions and 53 deletions
+13 -1
View File
@@ -1,4 +1,4 @@
/***
/***
Olive - Non-Linear Video Editor
Copyright (C) 2019 Olive Team
@@ -29,6 +29,11 @@
class RenderTexture : public QObject
{
public:
enum Type {
kSingleBuffer,
kDoubleBuffer
};
RenderTexture();
~RenderTexture();
RenderTexture(const RenderTexture& other) = delete;
@@ -37,6 +42,7 @@ public:
RenderTexture& operator=(RenderTexture&& other) = delete;
void Create(QOpenGLContext* ctx, int width, int height, const olive::PixelFormat &format, void *data = nullptr);
void Create(QOpenGLContext* ctx, int width, int height, const olive::PixelFormat &format, const Type& type, void *data = nullptr);
bool IsCreated() const;
@@ -55,16 +61,22 @@ public:
QOpenGLContext* context() const;
const GLuint& texture() const;
const GLuint& back_texture() const;
void SwapFrontAndBack();
void Upload(void* data);
void* Download() const;
private:
void CreateInternal(void *data = nullptr);
QOpenGLContext* context_;
GLuint texture_;
GLuint back_texture_;
int width_;
int height_;