diff options
author | Jan Holesovsky <kendy@collabora.com> | 2014-11-14 15:43:44 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-11-15 13:51:53 +0100 |
commit | 1d2c5224b24f0509365cf69e835063a1e3a3bec1 (patch) | |
tree | 2a0a4bc3e9a9ffebcd76e03b1ff3ee7abd7b5b18 /vcl/opengl/texture.cxx | |
parent | 3bc5e986b38f620db9d0119b5d431c10c67eeb74 (diff) |
opengl: Add many more CHECK_GL_ERROR()'s before returning from functions.
Change-Id: I63c147acf9a4013008b0f6d76867186f04ee57d5
Diffstat (limited to 'vcl/opengl/texture.cxx')
-rw-r--r-- | vcl/opengl/texture.cxx | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/vcl/opengl/texture.cxx b/vcl/opengl/texture.cxx index 005fb66afa2e..5c2f3c12254a 100644 --- a/vcl/opengl/texture.cxx +++ b/vcl/opengl/texture.cxx @@ -40,6 +40,8 @@ ImplOpenGLTexture::ImplOpenGLTexture( int nWidth, int nHeight, bool bAllocate ) if( bAllocate ) glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, nWidth, nHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL ); glBindTexture( GL_TEXTURE_2D, 0 ); + + CHECK_GL_ERROR(); } // texture with content retrieved from FBO @@ -59,6 +61,7 @@ ImplOpenGLTexture::ImplOpenGLTexture( int nX, int nY, int nWidth, int nHeight ) glCopyTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, nX, nY, nWidth, nHeight, 0 ); CHECK_GL_ERROR(); glBindTexture( GL_TEXTURE_2D, 0 ); + CHECK_GL_ERROR(); } @@ -80,6 +83,8 @@ ImplOpenGLTexture::ImplOpenGLTexture( int nWidth, int nHeight, int nFormat, int glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST ); glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, mnWidth, mnHeight, 0, nFormat, nType, pData ); glBindTexture( GL_TEXTURE_2D, 0 ); + + CHECK_GL_ERROR(); } ImplOpenGLTexture::~ImplOpenGLTexture() @@ -87,6 +92,8 @@ ImplOpenGLTexture::~ImplOpenGLTexture() SAL_INFO( "vcl.opengl", "~OpenGLTexture " << mnTexture ); if( mnTexture != 0 ) glDeleteTextures( 1, &mnTexture ); + + CHECK_GL_ERROR(); } OpenGLTexture::OpenGLTexture() : @@ -198,18 +205,24 @@ void OpenGLTexture::SetFilter( GLenum nFilter ) glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, nFilter ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, nFilter ); } + + CHECK_GL_ERROR(); } void OpenGLTexture::Bind() { if( mpImpl ) glBindTexture( GL_TEXTURE_2D, mpImpl->mnTexture ); + + CHECK_GL_ERROR(); } void OpenGLTexture::Unbind() { if( mpImpl ) glBindTexture( GL_TEXTURE_2D, 0 ); + + CHECK_GL_ERROR(); } bool OpenGLTexture::Draw() @@ -243,6 +256,7 @@ bool OpenGLTexture::Draw() glDisableVertexAttribArray( 1 ); glBindTexture( GL_TEXTURE_2D, 0 ); + CHECK_GL_ERROR(); return true; } @@ -269,12 +283,12 @@ void OpenGLTexture::Read( GLenum nFormat, GLenum nType, sal_uInt8* pData ) GLuint nFramebufferId; glGenFramebuffers( 1, &nFramebufferId ); glBindFramebuffer( GL_FRAMEBUFFER, nFramebufferId ); - CHECK_GL_ERROR(); + CHECK_GL_ERROR(); glFramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, Id(), 0 ); - CHECK_GL_ERROR(); + CHECK_GL_ERROR(); glReadPixels( maRect.Left(), mpImpl->mnHeight - maRect.Top(), GetWidth(), GetHeight(), nFormat, nType, pData ); - CHECK_GL_ERROR(); + CHECK_GL_ERROR(); glBindFramebuffer( GL_FRAMEBUFFER, 0 ); glDeleteFramebuffers( 1, &nFramebufferId ); |