removed double buffered textures

These functions never ended up getting used, and have the potential to become
confusing in implementation.
This commit is contained in:
itsmattkc
2019-12-09 23:59:00 +11:00
parent 26b3993b9d
commit 3dc563b697
4 changed files with 1 additions and 55 deletions
@@ -98,16 +98,6 @@ void OpenGLFramebuffer::Attach(OpenGLTexturePtr texture)
AttachInternal(texture_->texture(), false); AttachInternal(texture_->texture(), false);
} }
void OpenGLFramebuffer::AttachBackBuffer(OpenGLTexturePtr texture)
{
if (context_ == nullptr) {
return;
}
texture_ = texture;
AttachInternal(texture_->back_texture(), true);
}
void OpenGLFramebuffer::Detach() void OpenGLFramebuffer::Detach()
{ {
if (context_ == nullptr) { if (context_ == nullptr) {
@@ -45,8 +45,6 @@ public:
void Attach(OpenGLTexturePtr texture); void Attach(OpenGLTexturePtr texture);
void AttachBackBuffer(OpenGLTexturePtr texture);
void Detach(); void Detach();
const GLuint& buffer() const; const GLuint& buffer() const;
+1 -32
View File
@@ -28,7 +28,6 @@
OpenGLTexture::OpenGLTexture() : OpenGLTexture::OpenGLTexture() :
context_(nullptr), context_(nullptr),
texture_(0), texture_(0),
back_texture_(0),
width_(0), width_(0),
height_(0), height_(0),
format_(olive::PIX_FMT_INVALID) format_(olive::PIX_FMT_INVALID)
@@ -46,11 +45,6 @@ bool OpenGLTexture::IsCreated() const
} }
void OpenGLTexture::Create(QOpenGLContext *ctx, int width, int height, const olive::PixelFormat &format, void* data) void OpenGLTexture::Create(QOpenGLContext *ctx, int width, int height, const olive::PixelFormat &format, void* data)
{
Create(ctx, width, height, format, kSingleBuffer, data);
}
void OpenGLTexture::Create(QOpenGLContext *ctx, int width, int height, const olive::PixelFormat &format, const OpenGLTexture::Type &type, void *data)
{ {
if (ctx == nullptr) { if (ctx == nullptr) {
qWarning() << "RenderTexture::Create was passed an invalid context"; qWarning() << "RenderTexture::Create was passed an invalid context";
@@ -68,21 +62,11 @@ void OpenGLTexture::Create(QOpenGLContext *ctx, int width, int height, const oli
// Create main texture // Create main texture
CreateInternal(&texture_, data); CreateInternal(&texture_, data);
if (type == kDoubleBuffer) {
// Create back texture
CreateInternal(&back_texture_, nullptr);
}
}
void OpenGLTexture::Create(QOpenGLContext *ctx, FramePtr frame, const Type &type)
{
Create(ctx, frame->width(), frame->height(), frame->format(), type, frame->data());
} }
void OpenGLTexture::Create(QOpenGLContext *ctx, FramePtr frame) void OpenGLTexture::Create(QOpenGLContext *ctx, FramePtr frame)
{ {
Create(ctx, frame, kSingleBuffer); Create(ctx, frame->width(), frame->height(), frame->format(), frame->data());
} }
void OpenGLTexture::Destroy() void OpenGLTexture::Destroy()
@@ -93,9 +77,6 @@ void OpenGLTexture::Destroy()
context_->functions()->glDeleteTextures(1, &texture_); context_->functions()->glDeleteTextures(1, &texture_);
texture_ = 0; texture_ = 0;
context_->functions()->glDeleteTextures(1, &back_texture_);
back_texture_ = 0;
context_ = nullptr; context_ = nullptr;
} }
} }
@@ -145,18 +126,6 @@ const GLuint &OpenGLTexture::texture() const
return texture_; return texture_;
} }
const GLuint &OpenGLTexture::back_texture() const
{
return back_texture_;
}
void OpenGLTexture::SwapFrontAndBack()
{
GLuint temp = texture_;
texture_ = back_texture_;
back_texture_ = temp;
}
void OpenGLTexture::Upload(const void *data) void OpenGLTexture::Upload(const void *data)
{ {
if (!IsCreated()) { if (!IsCreated()) {
-11
View File
@@ -35,19 +35,12 @@ class OpenGLTexture : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
enum Type {
kSingleBuffer,
kDoubleBuffer
};
OpenGLTexture(); OpenGLTexture();
virtual ~OpenGLTexture() override; virtual ~OpenGLTexture() override;
DISABLE_COPY_MOVE(OpenGLTexture) DISABLE_COPY_MOVE(OpenGLTexture)
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, void *data = nullptr);
void Create(QOpenGLContext* ctx, int width, int height, const olive::PixelFormat &format, const Type& type, void *data = nullptr);
void Create(QOpenGLContext* ctx, FramePtr frame, const Type& type);
void Create(QOpenGLContext* ctx, FramePtr frame); void Create(QOpenGLContext* ctx, FramePtr frame);
bool IsCreated() const; bool IsCreated() const;
@@ -65,8 +58,6 @@ public:
QOpenGLContext* context() const; QOpenGLContext* context() const;
const GLuint& texture() const; const GLuint& texture() const;
const GLuint& back_texture() const;
void SwapFrontAndBack();
void Upload(const void *data); void Upload(const void *data);
@@ -82,8 +73,6 @@ private:
GLuint texture_; GLuint texture_;
GLuint back_texture_;
int width_; int width_;
int height_; int height_;