Unbind everything before deleting
This commit is contained in:
parent
2667791621
commit
36d20773d7
@ -267,7 +267,6 @@ GLuint generateSpecularCubemap(GLuint probe)
|
|||||||
GLenum bufs[] = { GL_COLOR_ATTACHMENT0 };
|
GLenum bufs[] = { GL_COLOR_ATTACHMENT0 };
|
||||||
glDrawBuffers(1, bufs);
|
glDrawBuffers(1, bufs);
|
||||||
glUseProgram(UtilShader::SpecularIBLGenerator::getInstance()->Program);
|
glUseProgram(UtilShader::SpecularIBLGenerator::getInstance()->Program);
|
||||||
glBindVertexArray(SharedObject::FullScreenQuadVAO);
|
|
||||||
|
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
@ -298,6 +297,7 @@ GLuint generateSpecularCubemap(GLuint probe)
|
|||||||
tmp[2 * i + 1] = sample.second;
|
tmp[2 * i + 1] = sample.second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glBindVertexArray(0);
|
||||||
glActiveTexture(GL_TEXTURE0 + UtilShader::SpecularIBLGenerator::getInstance()->TU_Samples);
|
glActiveTexture(GL_TEXTURE0 + UtilShader::SpecularIBLGenerator::getInstance()->TU_Samples);
|
||||||
GLuint sampleTex, sampleBuffer;
|
GLuint sampleTex, sampleBuffer;
|
||||||
glGenBuffers(1, &sampleBuffer);
|
glGenBuffers(1, &sampleBuffer);
|
||||||
@ -306,6 +306,7 @@ GLuint generateSpecularCubemap(GLuint probe)
|
|||||||
glGenTextures(1, &sampleTex);
|
glGenTextures(1, &sampleTex);
|
||||||
glBindTexture(GL_TEXTURE_BUFFER, sampleTex);
|
glBindTexture(GL_TEXTURE_BUFFER, sampleTex);
|
||||||
glTexBuffer(GL_TEXTURE_BUFFER, GL_RG32F, sampleBuffer);
|
glTexBuffer(GL_TEXTURE_BUFFER, GL_RG32F, sampleBuffer);
|
||||||
|
glBindVertexArray(SharedObject::FullScreenQuadVAO);
|
||||||
|
|
||||||
for (unsigned face = 0; face < 6; face++)
|
for (unsigned face = 0; face < 6; face++)
|
||||||
{
|
{
|
||||||
@ -319,12 +320,15 @@ GLuint generateSpecularCubemap(GLuint probe)
|
|||||||
|
|
||||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||||
}
|
}
|
||||||
|
glActiveTexture(GL_TEXTURE0 + UtilShader::SpecularIBLGenerator::getInstance()->TU_Samples);
|
||||||
|
glBindBuffer(GL_TEXTURE_BUFFER, 0);
|
||||||
|
glBindTexture(GL_TEXTURE_BUFFER, 0);
|
||||||
|
|
||||||
delete[] tmp;
|
delete[] tmp;
|
||||||
glDeleteTextures(1, &sampleTex);
|
glDeleteTextures(1, &sampleTex);
|
||||||
glDeleteBuffers(1, &sampleBuffer);
|
glDeleteBuffers(1, &sampleBuffer);
|
||||||
}
|
}
|
||||||
|
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||||
glDeleteFramebuffers(1, &fbo);
|
glDeleteFramebuffers(1, &fbo);
|
||||||
return cubemap_texture;
|
return cubemap_texture;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user