fixed various caching issues
This commit is contained in:
@@ -48,6 +48,8 @@ void RenderFramebuffer::Create(QOpenGLContext *ctx)
|
||||
|
||||
context_ = ctx;
|
||||
|
||||
connect(context_, SIGNAL(aboutToBeDestroyed()), this, SLOT(Destroy()));
|
||||
|
||||
// Create framebuffer object
|
||||
context_->functions()->glGenFramebuffers(1, &buffer_);
|
||||
}
|
||||
@@ -55,6 +57,8 @@ void RenderFramebuffer::Create(QOpenGLContext *ctx)
|
||||
void RenderFramebuffer::Destroy()
|
||||
{
|
||||
if (context_ != nullptr) {
|
||||
disconnect(context_, SIGNAL(aboutToBeDestroyed()), this, SLOT(Destroy()));
|
||||
|
||||
context_->functions()->glDeleteFramebuffers(1, &buffer_);
|
||||
|
||||
buffer_ = 0;
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
class RenderFramebuffer : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
RenderFramebuffer();
|
||||
~RenderFramebuffer();
|
||||
@@ -37,8 +38,6 @@ public:
|
||||
|
||||
void Create(QOpenGLContext *ctx);
|
||||
|
||||
void Destroy();
|
||||
|
||||
bool IsCreated() const;
|
||||
|
||||
void Bind();
|
||||
@@ -53,6 +52,9 @@ public:
|
||||
|
||||
const GLuint& buffer() const;
|
||||
|
||||
public slots:
|
||||
void Destroy();
|
||||
|
||||
private:
|
||||
void AttachInternal(GLuint tex);
|
||||
|
||||
|
||||
@@ -25,10 +25,6 @@
|
||||
|
||||
#include "render/pixelservice.h"
|
||||
|
||||
// FIXME: Test code
|
||||
QMutex m;
|
||||
// End test code
|
||||
|
||||
RenderTexture::RenderTexture() :
|
||||
context_(nullptr),
|
||||
texture_(0)
|
||||
@@ -64,6 +60,8 @@ void RenderTexture::Create(QOpenGLContext *ctx, int width, int height, const oli
|
||||
height_ = height;
|
||||
format_ = format;
|
||||
|
||||
connect(context_, SIGNAL(aboutToBeDestroyed()), this, SLOT(Destroy()));
|
||||
|
||||
// Create main texture
|
||||
CreateInternal(&texture_, data);
|
||||
|
||||
@@ -76,6 +74,8 @@ void RenderTexture::Create(QOpenGLContext *ctx, int width, int height, const oli
|
||||
void RenderTexture::Destroy()
|
||||
{
|
||||
if (context_ != nullptr) {
|
||||
disconnect(context_, SIGNAL(aboutToBeDestroyed()), this, SLOT(Destroy()));
|
||||
|
||||
context_->functions()->glDeleteTextures(1, &texture_);
|
||||
texture_ = 0;
|
||||
|
||||
|
||||
@@ -26,13 +26,9 @@
|
||||
|
||||
#include "pixelformat.h"
|
||||
|
||||
// FIXME: Test code
|
||||
#include <QMutex>
|
||||
extern QMutex m;
|
||||
// End test code
|
||||
|
||||
class RenderTexture : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum Type {
|
||||
kSingleBuffer,
|
||||
@@ -51,8 +47,6 @@ public:
|
||||
|
||||
bool IsCreated() const;
|
||||
|
||||
void Destroy();
|
||||
|
||||
void Bind();
|
||||
|
||||
void Release();
|
||||
@@ -73,6 +67,9 @@ public:
|
||||
|
||||
uchar *Download() const;
|
||||
|
||||
public slots:
|
||||
void Destroy();
|
||||
|
||||
private:
|
||||
void CreateInternal(GLuint *tex, void *data = nullptr);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user