diff --git a/src/osg/Image.cpp b/src/osg/Image.cpp index d1600fbf0..2208a239f 100644 --- a/src/osg/Image.cpp +++ b/src/osg/Image.cpp @@ -1210,6 +1210,9 @@ Geode* osg::createGeodeForImage(osg::Image* image) } +#include + + Geode* osg::createGeodeForImage(osg::Image* image,float s,float t) { if (image) @@ -1221,7 +1224,22 @@ Geode* osg::createGeodeForImage(osg::Image* image,float s,float t) float x = y*(s/t); // set up the texture. + +#if 0 + osg::TextureRectangle* texture = new osg::TextureRectangle; + texture->setFilter(osg::Texture::MIN_FILTER,osg::Texture::LINEAR); + texture->setFilter(osg::Texture::MAG_FILTER,osg::Texture::LINEAR); + //texture->setResizeNonPowerOfTwoHint(false); + float texcoord_x = image->s(); + float texcoord_y = image->t(); +#else osg::Texture2D* texture = new osg::Texture2D; + texture->setFilter(osg::Texture::MIN_FILTER,osg::Texture::LINEAR); + texture->setFilter(osg::Texture::MAG_FILTER,osg::Texture::LINEAR); + texture->setResizeNonPowerOfTwoHint(false); + float texcoord_x = 1.0f; + float texcoord_y = 1.0f; +#endif texture->setImage(image); // set up the drawstate. @@ -1242,10 +1260,10 @@ Geode* osg::createGeodeForImage(osg::Image* image,float s,float t) geom->setVertexArray(coords); Vec2Array* tcoords = new Vec2Array(4); - (*tcoords)[0].set(0.0f,1.0f); - (*tcoords)[1].set(0.0f,0.0f); - (*tcoords)[2].set(1.0f,0.0f); - (*tcoords)[3].set(1.0f,1.0f); + (*tcoords)[0].set(0.0f*texcoord_x,1.0f*texcoord_y); + (*tcoords)[1].set(0.0f*texcoord_x,0.0f*texcoord_y); + (*tcoords)[2].set(1.0f*texcoord_x,0.0f*texcoord_y); + (*tcoords)[3].set(1.0f*texcoord_x,1.0f*texcoord_y); geom->setTexCoordArray(0,tcoords); osg::Vec4Array* colours = new osg::Vec4Array(1);