diff --git a/src/osgTerrain/GeometryTechnique.cpp b/src/osgTerrain/GeometryTechnique.cpp index 30389f4e5..a3ac7b73e 100644 --- a/src/osgTerrain/GeometryTechnique.cpp +++ b/src/osgTerrain/GeometryTechnique.cpp @@ -348,6 +348,8 @@ void GeometryTechnique::init() } } + bool containsTransparency = false; + if (colorLayer) { osgTerrain::ImageLayer* imageLayer = dynamic_cast(colorLayer); @@ -362,17 +364,22 @@ void GeometryTechnique::init() stateset->setTextureAttributeAndModes(color_index, texture2D, osg::StateAttribute::ON); texture2D->setFilter(osg::Texture::MAG_FILTER, filter==TerrainNode::LINEAR ? osg::Texture::LINEAR : osg::Texture::NEAREST); - + if (tf) { // up the precision of hte internal texture format to its maximum. //image->setInternalTextureFormat(GL_LUMINANCE32F_ARB); image->setInternalTextureFormat(GL_LUMINANCE16); } + else + { + containsTransparency = image->isImageTranslucent(); + } } } + if (tf) { osg::notify(osg::NOTICE)<<"Requires TransferFunction"<setFilter(osg::Texture::MAG_FILTER, osg::Texture::NEAREST); stateset->setTextureAttributeAndModes(tf_index, texture1D, osg::StateAttribute::ON); + containsTransparency = image->isImageTranslucent(); + if (colorLayer) { osg::notify(osg::NOTICE)<<"Using fragment program"<getOrCreateStateSet(); + stateset->setMode(GL_BLEND, osg::StateAttribute::ON); + stateset->setRenderingHint(osg::StateSet::TRANSPARENT_BIN); + } // if (_terrainGeometry.valid()) _terrainGeometry->setUseDisplayList(false); if (_geometry.valid()) _geometry->setUseVertexBufferObjects(true);