Also clean up textures not created by SetPixels

This commit is contained in:
Magnus Norddahl 2019-12-26 00:46:05 +01:00
parent 9d5f8ec7c1
commit e68da4331a

View file

@ -127,9 +127,12 @@ void GLTexture::Invalidate()
GLuint GLTexture::GetTexture(GLRenderDevice* device)
{
if (mTexture == 0)
{
if (Device == nullptr)
{
Device = device;
ItTexture = Device->mTextures.insert(Device->mTextures.end(), this);
}
GLint oldActiveTex = GL_TEXTURE0;
glGetIntegerv(GL_ACTIVE_TEXTURE, &oldActiveTex);
@ -188,8 +191,12 @@ GLuint GLTexture::GetFramebuffer(GLRenderDevice* device, bool usedepthbuffer)
else
{
if (mDepthRenderbuffer == 0)
{
if (Device == nullptr)
{
Device = device;
ItTexture = Device->mTextures.insert(Device->mTextures.end(), this);
}
glGenRenderbuffers(1, &mDepthRenderbuffer);
glBindRenderbuffer(GL_RENDERBUFFER, mDepthRenderbuffer);
@ -215,8 +222,12 @@ GLuint GLTexture::GetFramebuffer(GLRenderDevice* device, bool usedepthbuffer)
GLuint GLTexture::GetPBO(GLRenderDevice* device)
{
if (mPBO == 0)
{
if (Device == nullptr)
{
Device = device;
ItTexture = Device->mTextures.insert(Device->mTextures.end(), this);
}
glGenBuffers(1, &mPBO);
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, mPBO);