Fixed RenderTexture
Former-commit-id: b67e9e5f49eb6339cf01cb4fa147ad9ed989d873
This commit is contained in:
parent
ea2cc97169
commit
a3a1538d9b
|
|
@ -245,7 +245,7 @@ bool NzRenderTexture::AttachTexture(nzAttachmentPoint attachmentPoint, nzUInt8 i
|
||||||
m_impl->attachements.resize(minSize);
|
m_impl->attachements.resize(minSize);
|
||||||
|
|
||||||
Attachment& attachment = m_impl->attachements[minSize-1];
|
Attachment& attachment = m_impl->attachements[minSize-1];
|
||||||
attachment.isBuffer = true;
|
attachment.isBuffer = false;
|
||||||
attachment.isUsed = true;
|
attachment.isUsed = true;
|
||||||
attachment.texture = texture;
|
attachment.texture = texture;
|
||||||
|
|
||||||
|
|
@ -334,7 +334,7 @@ void NzRenderTexture::Destroy()
|
||||||
|
|
||||||
m_impl->context->RemoveResourceListener(this);
|
m_impl->context->RemoveResourceListener(this);
|
||||||
|
|
||||||
for (Attachment& attachment : m_impl->attachements)
|
for (const Attachment& attachment : m_impl->attachements)
|
||||||
{
|
{
|
||||||
if (attachment.isUsed)
|
if (attachment.isUsed)
|
||||||
{
|
{
|
||||||
|
|
@ -342,8 +342,8 @@ void NzRenderTexture::Destroy()
|
||||||
glDeleteRenderbuffers(1, &attachment.buffer);
|
glDeleteRenderbuffers(1, &attachment.buffer);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
attachment.texture->RemoveResourceListener(this);
|
|
||||||
attachment.texture->SetRenderTexture(nullptr);
|
attachment.texture->SetRenderTexture(nullptr);
|
||||||
|
attachment.texture->RemoveResourceListener(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -644,6 +644,7 @@ void NzRenderTexture::OnResourceDestroy(const NzResource* resource, int index)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Sinon, c'est une texture
|
// Sinon, c'est une texture
|
||||||
|
resource->RemoveResourceListener(this);
|
||||||
|
|
||||||
// La ressource n'est plus, du coup nous mettons à jour
|
// La ressource n'est plus, du coup nous mettons à jour
|
||||||
Attachment& attachement = m_impl->attachements[index];
|
Attachment& attachement = m_impl->attachements[index];
|
||||||
|
|
@ -652,6 +653,4 @@ void NzRenderTexture::OnResourceDestroy(const NzResource* resource, int index)
|
||||||
m_impl->checked = false;
|
m_impl->checked = false;
|
||||||
m_impl->drawBuffersUpdated = false;
|
m_impl->drawBuffersUpdated = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
resource->RemoveResourceListener(this);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue