Branimir Karadžić 8 years ago
parent
commit
84692b51b3
1 changed files with 16 additions and 7 deletions
  1. 16 7
      src/renderer_gl.cpp

+ 16 - 7
src/renderer_gl.cpp

@@ -2777,23 +2777,32 @@ namespace bgfx { namespace gl
 
 					FrameBufferGL frameBuffer;
 					frameBuffer.create(1, attachment);
-					glBindFramebuffer(GL_FRAMEBUFFER, frameBuffer.m_fbo[0]);
-					glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture.m_id, attachment[0].mip);
+					GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, frameBuffer.m_fbo[0]) );
+					GL_CHECK(glFramebufferTexture2D(
+						  GL_FRAMEBUFFER
+						, GL_COLOR_ATTACHMENT0
+						, GL_TEXTURE_2D
+						, texture.m_id
+						, attachment[0].mip
+						) );
 
-					if (!BX_ENABLED(BX_PLATFORM_EMSCRIPTEN) && !BX_ENABLED(BX_PLATFORM_IOS))
+					if (!BX_ENABLED(BX_PLATFORM_EMSCRIPTEN)
+					&&  !BX_ENABLED(BX_PLATFORM_IOS))
 					{
-						GL_CHECK(glReadBuffer(GL_COLOR_ATTACHMENT0));
+						GL_CHECK(glReadBuffer(GL_COLOR_ATTACHMENT0) );
 					}
-					if (glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE) 
+
+					if (GL_FRAMEBUFFER_COMPLETE == glCheckFramebufferStatus(GL_FRAMEBUFFER) )
 					{
-						GL_CHECK(glReadPixels(0
+						GL_CHECK(glReadPixels(
+							  0
 							, 0
 							, texture.m_width
 							, texture.m_height
 							, m_readPixelsFmt
 							, GL_UNSIGNED_BYTE
 							, _data
-						));
+							) );
 					}
 
 					frameBuffer.destroy();