Introduced optional build against the GLU library, using optional compile paths to enable/disable GLU related function.
To toggle the use of the GLU library adjust the OSG_GLU_AVAILABLE variable via ccmake . or CMakeSetup.
This commit is contained in:
@@ -1747,7 +1747,7 @@ void Texture::applyTexImage2D_load(State& state, GLenum target, const Image* ima
|
||||
bool needImageRescale = inwidth!=image->s() || inheight!=image->t();
|
||||
if (needImageRescale)
|
||||
{
|
||||
|
||||
#ifdef OSG_GLU_AVAILABLE
|
||||
// resize the image to power of two.
|
||||
|
||||
if (image->isMipmap())
|
||||
@@ -1778,8 +1778,11 @@ void Texture::applyTexImage2D_load(State& state, GLenum target, const Image* ima
|
||||
gluScaleImage(image->getPixelFormat(),
|
||||
image->s(),image->t(),image->getDataType(),image->data(),
|
||||
inwidth,inheight,image->getDataType(),dataPtr);
|
||||
|
||||
}
|
||||
#else
|
||||
osg::notify(osg::NOTICE)<<"Warning: gluScaleImage(..) not supported, cannot subload image."<<std::endl;
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool mipmappingRequired = _min_filter != LINEAR && _min_filter != NEAREST;
|
||||
bool useHardwareMipMapGeneration = mipmappingRequired && (!image->isMipmap() && isHardwareMipmapGenerationEnabled(state));
|
||||
@@ -1891,7 +1894,7 @@ void Texture::applyTexImage2D_load(State& state, GLenum target, const Image* ima
|
||||
if ( !compressed_image)
|
||||
{
|
||||
numMipmapLevels = 0;
|
||||
|
||||
#ifdef OSG_GLU_AVAILABLE
|
||||
gluBuild2DMipmaps( target, _internalFormat,
|
||||
inwidth,inheight,
|
||||
(GLenum)image->getPixelFormat(), (GLenum)image->getDataType(),
|
||||
@@ -1904,6 +1907,9 @@ void Texture::applyTexImage2D_load(State& state, GLenum target, const Image* ima
|
||||
width >>= 1;
|
||||
height >>= 1;
|
||||
}
|
||||
#else
|
||||
osg::notify(osg::NOTICE)<<"Warning:: gluBuild2DMipMaps(..) not supported."<<std::endl;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1989,9 +1995,8 @@ void Texture::applyTexImage2D_subload(State& state, GLenum target, const Image*
|
||||
bool needImageRescale = inwidth!=image->s() || inheight!=image->t();
|
||||
if (needImageRescale)
|
||||
{
|
||||
|
||||
#ifdef OSG_GLU_AVAILABLE
|
||||
// resize the image to power of two.
|
||||
|
||||
if (image->isMipmap())
|
||||
{
|
||||
notify(WARN)<<"Warning:: Mipmapped osg::Image not a power of two, cannot apply to texture."<<std::endl;
|
||||
@@ -2002,10 +2007,10 @@ void Texture::applyTexImage2D_subload(State& state, GLenum target, const Image*
|
||||
notify(WARN)<<"Warning:: Compressed osg::Image not a power of two, cannot apply to texture."<<std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
unsigned int newTotalSize = osg::Image::computeRowWidthInBytes(inwidth,image->getPixelFormat(),image->getDataType(),image->getPacking())*inheight;
|
||||
data = new unsigned char [newTotalSize];
|
||||
|
||||
|
||||
if (!data)
|
||||
{
|
||||
notify(WARN)<<"Warning:: Not enough memory to resize image, cannot apply to texture."<<std::endl;
|
||||
@@ -2020,6 +2025,10 @@ void Texture::applyTexImage2D_subload(State& state, GLenum target, const Image*
|
||||
gluScaleImage(image->getPixelFormat(),
|
||||
image->s(),image->t(),image->getDataType(),image->data(),
|
||||
inwidth,inheight,image->getDataType(),data);
|
||||
#else
|
||||
osg::notify(osg::NOTICE)<<"Warning: gluScaleImage(..) not supported, cannot subload image."<<std::endl;
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user