diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-03-02 15:15:17 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-03-02 15:15:17 +0100 |
commit | cf6d0fced8bc8770ca101b71187c8d0ed28ae1f1 (patch) | |
tree | 16153945b183bb7e4e237006c8e591a0e9c44fe0 | |
parent | ff28e99c5bffc95b06908f30469caa276efa2b38 (diff) |
Replace uses of deprecated gluBuild2DMipmaps
...with glGenerateMipmap (since OpenGL 3.0) or GL_GENERATE_MIPMAP (since OpenGL
1.4). Appears to make slide transitions not worse on Linux and Mac OS X, while
actually improving them on Windows (where the transitions were rendered in just
white w/o textures), at least on the specific machines I tested on.
Change-Id: I1e4c115223521acd3f254bdbf0330a7830160a9c
-rw-r--r-- | slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx index a878b08c9f7e..6d2e66899df5 100644 --- a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx +++ b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx @@ -957,6 +957,31 @@ namespace } } +namespace { + +void buildMipmaps( + GLint internalFormat, GLsizei width, GLsizei height, GLenum format, + GLenum type, const void * data) +{ + if (GLEW_ARB_framebuffer_object) { + glTexImage2D( + GL_TEXTURE_2D, 0, internalFormat, width, height, 0, format, type, + data); + glGenerateMipmap(GL_TEXTURE_2D); + } else { + glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE); + glTexImage2D( + GL_TEXTURE_2D, 0, internalFormat, width, height, 0, format, type, + data); + glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_FALSE); + } + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri( + GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); +} + +} + void OGLTransitionerImpl::impl_createTexture( bool useMipmap, uno::Sequence<sal_Int8>& data, @@ -970,17 +995,12 @@ void OGLTransitionerImpl::impl_createTexture( maSlideBitmapLayout.ColorSpace->convertToIntegerColorSpace( data, getOGLColorSpace())); - SAL_WNODEPRECATED_DECLARATIONS_PUSH //TODO: 10.9 gluBuild2DMipmaps - gluBuild2DMipmaps(GL_TEXTURE_2D, - 4, + buildMipmaps( 4, maSlideSize.Width, maSlideSize.Height, GL_RGBA, GL_UNSIGNED_BYTE, &tempBytes[0]); - SAL_WNODEPRECATED_DECLARATIONS_POP - glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_LINEAR); //TRILINEAR FILTERING //anistropic filtering (to make texturing not suck when looking at polygons from oblique angles) GLfloat largest_supported_anisotropy; @@ -992,11 +1012,7 @@ void OGLTransitionerImpl::impl_createTexture( glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); } else { - SAL_WNODEPRECATED_DECLARATIONS_PUSH //TODO: 10.9 gluBuild2DMipmaps - gluBuild2DMipmaps( GL_TEXTURE_2D, pFormat->nInternalFormat, maSlideSize.Width, maSlideSize.Height, pFormat->eFormat, pFormat->eType, &data[0] ); - SAL_WNODEPRECATED_DECLARATIONS_POP - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR ); //TRILINEAR FILTERING + buildMipmaps( pFormat->nInternalFormat, maSlideSize.Width, maSlideSize.Height, pFormat->eFormat, pFormat->eType, &data[0] ); //anistropic filtering (to make texturing not suck when looking at polygons from oblique angles) GLfloat largest_supported_anisotropy; |