Fixed framebuffer binding messed up after a call to Texture::copyToImage() on OpenGL ES
This commit is contained in:
parent
218c0897c8
commit
67177ce55c
@ -48,6 +48,7 @@
|
|||||||
#define glFramebufferTexture2D glFramebufferTexture2DOES
|
#define glFramebufferTexture2D glFramebufferTexture2DOES
|
||||||
#define glCheckFramebufferStatus glCheckFramebufferStatusOES
|
#define glCheckFramebufferStatus glCheckFramebufferStatusOES
|
||||||
#define GL_FRAMEBUFFER GL_FRAMEBUFFER_OES
|
#define GL_FRAMEBUFFER GL_FRAMEBUFFER_OES
|
||||||
|
#define GL_FRAMEBUFFER_BINDING GL_FRAMEBUFFER_BINDING_OES
|
||||||
#define GL_RENDERBUFFER GL_RENDERBUFFER_OES
|
#define GL_RENDERBUFFER GL_RENDERBUFFER_OES
|
||||||
#define GL_COLOR_ATTACHMENT0 GL_COLOR_ATTACHMENT0_OES
|
#define GL_COLOR_ATTACHMENT0 GL_COLOR_ATTACHMENT0_OES
|
||||||
#define GL_DEPTH_ATTACHMENT GL_DEPTH_ATTACHMENT_OES
|
#define GL_DEPTH_ATTACHMENT GL_DEPTH_ATTACHMENT_OES
|
||||||
@ -75,6 +76,7 @@
|
|||||||
#define glFramebufferTexture2D glFramebufferTexture2DEXT
|
#define glFramebufferTexture2D glFramebufferTexture2DEXT
|
||||||
#define glCheckFramebufferStatus glCheckFramebufferStatusEXT
|
#define glCheckFramebufferStatus glCheckFramebufferStatusEXT
|
||||||
#define GL_FRAMEBUFFER GL_FRAMEBUFFER_EXT
|
#define GL_FRAMEBUFFER GL_FRAMEBUFFER_EXT
|
||||||
|
#define GL_FRAMEBUFFER_BINDING GL_FRAMEBUFFER_BINDING_EXT
|
||||||
#define GL_RENDERBUFFER GL_RENDERBUFFER_EXT
|
#define GL_RENDERBUFFER GL_RENDERBUFFER_EXT
|
||||||
#define GL_COLOR_ATTACHMENT0 GL_COLOR_ATTACHMENT0_EXT
|
#define GL_COLOR_ATTACHMENT0 GL_COLOR_ATTACHMENT0_EXT
|
||||||
#define GL_DEPTH_ATTACHMENT GL_DEPTH_ATTACHMENT_EXT
|
#define GL_DEPTH_ATTACHMENT GL_DEPTH_ATTACHMENT_EXT
|
||||||
|
@ -274,10 +274,15 @@ Image Texture::copyToImage() const
|
|||||||
glCheck(glGenFramebuffers(1, &frameBuffer));
|
glCheck(glGenFramebuffers(1, &frameBuffer));
|
||||||
if (frameBuffer)
|
if (frameBuffer)
|
||||||
{
|
{
|
||||||
|
GLint previousFrameBuffer;
|
||||||
|
glCheck(glGetIntegerv(GL_FRAMEBUFFER_BINDING, &previousFrameBuffer));
|
||||||
|
|
||||||
glCheck(glBindFramebuffer(GL_FRAMEBUFFER, frameBuffer));
|
glCheck(glBindFramebuffer(GL_FRAMEBUFFER, frameBuffer));
|
||||||
glCheck(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_texture, 0));
|
glCheck(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_texture, 0));
|
||||||
glCheck(glReadPixels(0, 0, m_size.x, m_size.y, GL_RGBA, GL_UNSIGNED_BYTE, &pixels[0]));
|
glCheck(glReadPixels(0, 0, m_size.x, m_size.y, GL_RGBA, GL_UNSIGNED_BYTE, &pixels[0]));
|
||||||
glCheck(glDeleteFramebuffers(1, &frameBuffer));
|
glCheck(glDeleteFramebuffers(1, &frameBuffer));
|
||||||
|
|
||||||
|
glCheck(glBindFramebuffer(GL_FRAMEBUFFER, previousFrameBuffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
Loading…
Reference in New Issue
Block a user