diff --git a/src/meshlab/glarea.cpp b/src/meshlab/glarea.cpp index 414416ca5..41c8fbdde 100644 --- a/src/meshlab/glarea.cpp +++ b/src/meshlab/glarea.cpp @@ -202,7 +202,7 @@ void GLArea::pasteTile() tileBuffer.format()); uchar* snapPtr = snapBuffer.bits() + (tileBuffer.bytesPerLine() * tileCol) + - ((totalCols * tileRow) * tileBuffer.byteCount()); + ((totalCols * tileRow) * tileBuffer.sizeInBytes()); uchar* tilePtr = tileBuffer.bits(); for (int y = 0; y < tileBuffer.height(); y++) { @@ -2473,10 +2473,28 @@ void GLArea::setupTextureEnv( GLuint textid ) glPushAttrib(GL_ENABLE_BIT); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D,textid); - if(glas.textureMagFilter == 0 ) + switch(glas.textureWrapST) + { + case 0: + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); + break; + case 1: + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_MIRRORED_REPEAT ); + break; + case 2: + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE ); + break; + default: assert(0); break; + } + + if(glas.textureMagFilter == 0 ) glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST ); else glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); + if(glas.textureMinFilter == 0 ) glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST ); else diff --git a/src/meshlab/glarea_setting.cpp b/src/meshlab/glarea_setting.cpp index cca32d259..0c6b0d72a 100644 --- a/src/meshlab/glarea_setting.cpp +++ b/src/meshlab/glarea_setting.cpp @@ -17,9 +17,12 @@ void GLAreaSetting::initGlobalParameterList(RichParameterList& defaultGlobalPara QStringList textureMinFilterModes = (QStringList() << "Nearest" << "MipMap"); QStringList textureMagFilterModes = (QStringList() << "Nearest" << "Linear"); + QStringList textureWrapSTModes = (QStringList() << "Repeat" << "Mirrored Repeat" << "Clamp to Edge"); + defaultGlobalParamSet.addParam(RichEnum(textureMinFilterParam() , 1,textureMinFilterModes,"MeshLab Texture Minification Filtering","MeshLab GLarea's BackGround Color(top corner)")); defaultGlobalParamSet.addParam(RichEnum(textureMagFilterParam() , 1,textureMagFilterModes,"MeshLab Texture Magnification Filtering","MeshLab GLarea's BackGround Color(top corner)")); - + defaultGlobalParamSet.addParam(RichEnum(textureWrapSTParam() , 0,textureWrapSTModes,"MeshLab Texture Clamping","MeshLab Texture Clamping")); + defaultGlobalParamSet.addParam(RichBool(pointDistanceAttenuationParam() , true,"Perspective Varying Point Size","If true the size of the points is drawn with a size proprtional to the distance from the observer.")); defaultGlobalParamSet.addParam(RichBool(pointSmoothParam() , false,"Antialiased Point","If true the points are drawn with small circles instead of fast squared dots.")); defaultGlobalParamSet.addParam(RichFloat(pointSizeParam() , 2.0, "Point Size","The base size of points when drawn")); @@ -45,6 +48,7 @@ void GLAreaSetting::updateGlobalParameterSet( const RichParameterList& rps ) textureMinFilter = rps.getEnum(this->textureMinFilterParam()); textureMagFilter = rps.getEnum(this->textureMagFilterParam()); + textureWrapST = rps.getEnum(this->textureWrapSTParam()); pointDistanceAttenuation = rps.getBool(this->pointDistanceAttenuationParam()); pointSmooth = rps.getBool(this->pointSmoothParam()); diff --git a/src/meshlab/glarea_setting.h b/src/meshlab/glarea_setting.h index d75063466..da468408d 100644 --- a/src/meshlab/glarea_setting.h +++ b/src/meshlab/glarea_setting.h @@ -57,9 +57,11 @@ public: int textureMagFilter; int textureMinFilter; + int textureWrapST; inline static QString textureMinFilterParam() {return "MeshLab::Appearance::textureMinFilter";} inline static QString textureMagFilterParam() {return "MeshLab::Appearance::textureMagFilter";} - + inline static QString textureWrapSTParam() {return "MeshLab::Appearance::textureWrapST";} + bool pointDistanceAttenuation; inline static QString pointDistanceAttenuationParam() {return "MeshLab::Appearance::pointDistanceAttenuation";} bool pointSmooth;