| | 256 | { |
| | 257 | // fake texture for baseTexture, add a fake texture |
| | 258 | // we support by default at least one texture layer |
| | 259 | // without this fake texture we can not support |
| | 260 | // textured and not textured scene |
| | 261 | |
| | 262 | // TODO: at the moment the PSSM supports just one texture layer in the GLSL shader, multitexture are |
| | 263 | // not yet supported ! |
| | 264 | |
| | 265 | osg::Image* image = new osg::Image; |
| | 266 | // allocate the image data, noPixels x 1 x 1 with 4 rgba floats - equivilant to a Vec4! |
| | 267 | int noPixels = 1; |
| | 268 | image->allocateImage(noPixels,1,1,GL_RGBA,GL_FLOAT); |
| | 269 | image->setInternalTextureFormat(GL_RGBA); |
| | 270 | // fill in the image data. |
| | 271 | osg::Vec4* dataPtr = (osg::Vec4*)image->data(); |
| | 272 | osg::Vec4 color(1,1,1,1); |
| | 273 | *dataPtr = color; |
| | 274 | // make fake texture |
| | 275 | osg::Texture2D* fakeTex = new osg::Texture2D; |
| | 276 | fakeTex->setWrap(osg::Texture2D::WRAP_S,osg::Texture2D::CLAMP_TO_BORDER); |
| | 277 | fakeTex->setWrap(osg::Texture2D::WRAP_T,osg::Texture2D::CLAMP_TO_BORDER); |
| | 278 | fakeTex->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR); |
| | 279 | fakeTex->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR); |
| | 280 | fakeTex->setImage(image); |
| | 281 | // add fake texture |
| | 282 | _stateset->setTextureAttribute(_baseTextureUnit,fakeTex,osg::StateAttribute::ON); |
| | 283 | _stateset->setTextureMode(_baseTextureUnit,GL_TEXTURE_1D,osg::StateAttribute::OFF); |
| | 284 | _stateset->setTextureMode(_baseTextureUnit,GL_TEXTURE_2D,osg::StateAttribute::ON); |
| | 285 | _stateset->setTextureMode(_baseTextureUnit,GL_TEXTURE_3D,osg::StateAttribute::OFF); |
| | 286 | } |