From 9f6383f5dd0fc1e1389167757c818c4132f6d721 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 9 Mar 2004 14:59:33 +0000 Subject: [PATCH] Added TextureRectangle(Image*) contructor. --- include/osg/Texture2D | 2 +- include/osg/TextureRectangle | 2 ++ src/osg/Texture2D.cpp | 2 +- src/osg/TextureRectangle.cpp | 13 +++++++++++++ 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/include/osg/Texture2D b/include/osg/Texture2D index 042088d63..d1d5bea32 100644 --- a/include/osg/Texture2D +++ b/include/osg/Texture2D @@ -26,7 +26,7 @@ class SG_EXPORT Texture2D : public Texture Texture2D(); - Texture2D(osg::Image* image); + Texture2D(Image* image); /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ Texture2D(const Texture2D& text,const CopyOp& copyop=CopyOp::SHALLOW_COPY); diff --git a/include/osg/TextureRectangle b/include/osg/TextureRectangle index ce4a8cfad..8967dea1b 100644 --- a/include/osg/TextureRectangle +++ b/include/osg/TextureRectangle @@ -30,6 +30,8 @@ class SG_EXPORT TextureRectangle : public Texture TextureRectangle(); + TextureRectangle(Image* image); + /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ TextureRectangle(const TextureRectangle& text,const CopyOp& copyop=CopyOp::SHALLOW_COPY); diff --git a/src/osg/Texture2D.cpp b/src/osg/Texture2D.cpp index 1683bde84..fd560edf5 100644 --- a/src/osg/Texture2D.cpp +++ b/src/osg/Texture2D.cpp @@ -28,7 +28,7 @@ Texture2D::Texture2D(): setUseHardwareMipMapGeneration(true); } -Texture2D::Texture2D(osg::Image* image): +Texture2D::Texture2D(Image* image): _textureWidth(0), _textureHeight(0), _numMipmapLevels(0) diff --git a/src/osg/TextureRectangle.cpp b/src/osg/TextureRectangle.cpp index 85884ed8d..3bd9acd89 100644 --- a/src/osg/TextureRectangle.cpp +++ b/src/osg/TextureRectangle.cpp @@ -43,6 +43,19 @@ TextureRectangle::TextureRectangle(): setFilter(MAG_FILTER, LINEAR); } +TextureRectangle::TextureRectangle(Image* image): + _textureWidth(0), + _textureHeight(0) +{ + setWrap(WRAP_S, CLAMP); + setWrap(WRAP_T, CLAMP); + + setFilter(MIN_FILTER, LINEAR); + setFilter(MAG_FILTER, LINEAR); + + setImage(image); +} + TextureRectangle::TextureRectangle(const TextureRectangle& text,const CopyOp& copyop): Texture(text,copyop), _image(copyop(text._image.get())),