Kaydet (Commit) cf6d0fce authored tarafından Stephan Bergmann's avatar Stephan Bergmann

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
üst ff28e99c
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment