From: ouv Date: Thu, 6 Oct 2005 12:02:24 +0000 (+0000) Subject: Fixed Bug GVIEW10165 : Scalar bars are not removed from Viewers after switching from... X-Git-Tag: BR-D5-38-2003_D2005-12-10~44 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=2fb8e14fc7ad09f4b06a296f7a8b3fe5d3a1c00b;p=modules%2Fvisu.git Fixed Bug GVIEW10165 : Scalar bars are not removed from Viewers after switching from Result to Geometry mode --- diff --git a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx index 94739f9a..8ab150a4 100755 --- a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx +++ b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx @@ -318,54 +318,39 @@ void VISU_OpenGLPointSpriteMapper::SetPointSpriteResults( bool theResults ) //cout << "SetPointSpriteResults " << this << " " << aResults << endl; this->PointSpriteResults = theResults; -#ifdef GL_ARB_shader_objects - this->SetShaderVariable( "results", aResults ); -#endif + //#ifdef GL_ARB_shader_objects + //this->SetShaderVariable( "results", theMagnification ); + //#endif this->Modified(); } //----------------------------------------------------------------------------- void VISU_OpenGLPointSpriteMapper::SetPointSpriteClamp( float theClamp ) { this->PointSpriteClamp = theClamp; -#ifdef GL_ARB_shader_objects - this->SetShaderVariable( "clamp", theClamp ); -#endif this->Modified(); } //----------------------------------------------------------------------------- void VISU_OpenGLPointSpriteMapper::SetPointSpriteSize( float theSize ) { this->PointSpriteSize = theSize; -#ifdef GL_ARB_shader_objects - this->SetShaderVariable( "geomSize", theSize ); -#endif this->Modified(); } //----------------------------------------------------------------------------- void VISU_OpenGLPointSpriteMapper::SetPointSpriteMinSize( float theMinSize ) { this->PointSpriteMinSize = theMinSize; -#ifdef GL_ARB_shader_objects - this->SetShaderVariable( "minSize", theMinSize ); -#endif this->Modified(); } //----------------------------------------------------------------------------- void VISU_OpenGLPointSpriteMapper::SetPointSpriteMaxSize( float theMaxSize ) { this->PointSpriteMaxSize = theMaxSize; -#ifdef GL_ARB_shader_objects - this->SetShaderVariable( "maxSize", theMaxSize ); -#endif this->Modified(); } //----------------------------------------------------------------------------- void VISU_OpenGLPointSpriteMapper::SetPointSpriteMagnification( float theMagnification ) { this->PointSpriteMagnification = theMagnification; -#ifdef GL_ARB_shader_objects - this->SetShaderVariable( "magnification", theMagnification ); -#endif this->Modified(); } //----------------------------------------------------------------------------- @@ -429,7 +414,7 @@ void VISU_OpenGLPointSpriteMapper::InitExtensions() //PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB = // (PFNGLUSEPROGRAMOBJECTARBPROC)dlsym( this->OpenGLLibrary, "glUseProgramObjectARB" ); //glUseProgramObjectARB( VISU_OpenGLPointSpriteMapper::VertexProgram ); - + /* this->SetShaderVariable( "attrib1", 1.0 ); this->SetShaderVariable( "attrib2", 1.0 ); this->SetShaderVariable( "attrib3", 1.0 ); @@ -440,6 +425,7 @@ void VISU_OpenGLPointSpriteMapper::InitExtensions() this->SetShaderVariable( "minSize", this->PointSpriteMinSize ); this->SetShaderVariable( "maxSize", this->PointSpriteMaxSize ); this->SetShaderVariable( "magnification", this->PointSpriteMagnification ); + */ } #endif @@ -752,14 +738,28 @@ void VISU_OpenGLPointSpriteMapper::DrawPoints(int idx, glPointSize( this->DefaultPointSize ); #ifdef GL_ARB_vertex_buffer_object - PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB = - (PFNGLUSEPROGRAMOBJECTARBPROC)dlsym( this->OpenGLLibrary, "glUseProgramObjectARB" ); PFNGLGENBUFFERSARBPROC glGenBuffersARB = (PFNGLGENBUFFERSARBPROC)dlsym( this->OpenGLLibrary, "glGenBuffersARB" ); PFNGLBINDBUFFERARBPROC glBindBufferARB = (PFNGLBINDBUFFERARBPROC)dlsym( this->OpenGLLibrary, "glBindBufferARB" ); PFNGLBUFFERDATAARBPROC glBufferDataARB = (PFNGLBUFFERDATAARBPROC)dlsym( this->OpenGLLibrary, "glBufferDataARB" ); +#ifdef GL_ARB_shader_objects + PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB = + (PFNGLUSEPROGRAMOBJECTARBPROC)dlsym( this->OpenGLLibrary, "glUseProgramObjectARB" ); + glUseProgramObjectARB( myVertexProgram ); + this->SetShaderVariable( "attrib1", 0.0 ); + this->SetShaderVariable( "attrib2", 0.0 ); + this->SetShaderVariable( "attrib3", 0.0 ); + this->SetShaderVariable( "results", this->PointSpriteResults ); + this->SetShaderVariable( "clamp", this->PointSpriteClamp ); + this->SetShaderVariable( "geomSize", this->PointSpriteSize ); + this->SetShaderVariable( "attrib4", 0.0 ); + this->SetShaderVariable( "minSize", this->PointSpriteMinSize ); + this->SetShaderVariable( "maxSize", this->PointSpriteMaxSize ); + this->SetShaderVariable( "magnification", this->PointSpriteMagnification ); +#endif + TVertex* aVertex = new TVertex[ this->TotalCells ]; vtkIdType *pts = 0; @@ -812,7 +812,10 @@ void VISU_OpenGLPointSpriteMapper::DrawPoints(int idx, glDisableClientState(GL_COLOR_ARRAY); glDisableClientState(GL_VERTEX_ARRAY); +#ifdef GL_ARB_shader_objects glUseProgramObjectARB( 0 ); +#endif + #endif if( this->UsePointSprites ) diff --git a/src/VISU_I/VISU_GaussPoints_i.cc b/src/VISU_I/VISU_GaussPoints_i.cc index 12bb52e7..3aca4537 100644 --- a/src/VISU_I/VISU_GaussPoints_i.cc +++ b/src/VISU_I/VISU_GaussPoints_i.cc @@ -538,81 +538,82 @@ void VISU::GaussPoints_i ::UpdateActor(VISU_Actor* theActor) { - TSuperClass::UpdateActor(theActor); if(VISU_GaussPtsAct* anActor = dynamic_cast(theActor)){ if(GetIsColored()){ anActor->SetBarVisibility(true); myPipeLine->GetMapper()->SetScalarVisibility(1); - } - else{ - anActor->SetBarVisibility(false); - myPipeLine->GetMapper()->SetScalarVisibility(0); - anActor->GetProperty()->SetColor(myColor.red() / 255.0, - myColor.green() / 255.0, - myColor.blue() / 255.0); - } - if(VISU_ScalarBarCtrl *aScalarBarCtrl = anActor->GetScalarBarCtrl()){ - vtkIdType aScalarMode = GetScalarMode(); - TMinMax aTMinMax = myField->GetMinMax(aScalarMode); - float *aRange = myScalarMapPL->GetBarTable()->GetRange(); + if(VISU_ScalarBarCtrl *aScalarBarCtrl = anActor->GetScalarBarCtrl()){ + vtkIdType aScalarMode = GetScalarMode(); + TMinMax aTMinMax = myField->GetMinMax(aScalarMode); + float *aRange = myScalarMapPL->GetBarTable()->GetRange(); - aScalarBarCtrl->SetRangeGlobal(aTMinMax.first, aTMinMax.second); - aScalarBarCtrl->SetRangeLocal(aRange); + aScalarBarCtrl->SetRangeGlobal(aTMinMax.first, aTMinMax.second); + aScalarBarCtrl->SetRangeLocal(aRange); - aScalarBarCtrl->SetOrientation(myOrientation); + aScalarBarCtrl->SetOrientation(myOrientation); - int aScalarBarMode; - if(myIsActiveLocalScalarBar){ - aScalarBarMode = 2; - } - else{ - if(myIsDispGlobalScalarBar){ - aScalarBarMode = 1; + int aScalarBarMode; + if(myIsActiveLocalScalarBar){ + aScalarBarMode = 2; } else{ - aScalarBarMode = 0; - aScalarBarCtrl->SetRangeGlobal(aRange); + if(myIsDispGlobalScalarBar){ + aScalarBarMode = 1; + } + else{ + aScalarBarMode = 0; + aScalarBarCtrl->SetRangeGlobal(aRange); + } } - } - aScalarBarCtrl->SetMode(aScalarBarMode); + aScalarBarCtrl->SetMode(aScalarBarMode); - // Position - aScalarBarCtrl->SetWidth(myWidth); - aScalarBarCtrl->SetHeight(myHeight); - aScalarBarCtrl->SetPosition(myPosition); + // Position + aScalarBarCtrl->SetWidth(myWidth); + aScalarBarCtrl->SetHeight(myHeight); + aScalarBarCtrl->SetPosition(myPosition); - aScalarBarCtrl->SetSpacing(mySpacing); + aScalarBarCtrl->SetSpacing(mySpacing); - // Bicolor - bool anIsBicolor = GetGaussPointsPL()->GetBicolor(); - aScalarBarCtrl->SetBicolor(anIsBicolor); + // Bicolor + bool anIsBicolor = GetGaussPointsPL()->GetBicolor(); + aScalarBarCtrl->SetBicolor(anIsBicolor); - aScalarBarCtrl->Update(); + aScalarBarCtrl->Update(); - for(int i = 0; i < 2; ++i){ - vtkScalarBarActor *aScalarBar = aScalarBarCtrl->GetScalarBarActor(i); - aScalarBar->SetTitle(myTitle.c_str()); - aScalarBar->SetNumberOfLabels(myNumberOfLabels); - - vtkTextProperty* aTitleProp = aScalarBar->GetTitleTextProperty(); - aTitleProp->SetFontFamily(myTitFontType); - aTitleProp->SetColor(myTitleColor); - (myIsBoldTitle)? aTitleProp->BoldOn() : aTitleProp->BoldOff(); - (myIsItalicTitle)? aTitleProp->ItalicOn() : aTitleProp->ItalicOff(); - (myIsShadowTitle)? aTitleProp->ShadowOn() : aTitleProp->ShadowOff(); + for(int i = 0; i < 2; ++i){ + vtkScalarBarActor *aScalarBar = aScalarBarCtrl->GetScalarBarActor(i); + aScalarBar->SetTitle(myTitle.c_str()); + aScalarBar->SetNumberOfLabels(myNumberOfLabels); + + vtkTextProperty* aTitleProp = aScalarBar->GetTitleTextProperty(); + aTitleProp->SetFontFamily(myTitFontType); + aTitleProp->SetColor(myTitleColor); + (myIsBoldTitle)? aTitleProp->BoldOn() : aTitleProp->BoldOff(); + (myIsItalicTitle)? aTitleProp->ItalicOn() : aTitleProp->ItalicOff(); + (myIsShadowTitle)? aTitleProp->ShadowOn() : aTitleProp->ShadowOff(); - vtkTextProperty* aLabelProp = aScalarBar->GetLabelTextProperty(); - aLabelProp->SetFontFamily(myLblFontType); - aLabelProp->SetColor(myLabelColor); - (myIsBoldLabel)? aLabelProp->BoldOn() : aLabelProp->BoldOff(); - (myIsItalicLabel)? aLabelProp->ItalicOn() : aLabelProp->ItalicOff(); - (myIsShadowLabel)? aLabelProp->ShadowOn() : aLabelProp->ShadowOff(); + vtkTextProperty* aLabelProp = aScalarBar->GetLabelTextProperty(); + aLabelProp->SetFontFamily(myLblFontType); + aLabelProp->SetColor(myLabelColor); + (myIsBoldLabel)? aLabelProp->BoldOn() : aLabelProp->BoldOff(); + (myIsItalicLabel)? aLabelProp->ItalicOn() : aLabelProp->ItalicOff(); + (myIsShadowLabel)? aLabelProp->ShadowOn() : aLabelProp->ShadowOff(); - aScalarBar->Modified(); + aScalarBar->Modified(); + } } } + else{ + anActor->SetBarVisibility(false); + myPipeLine->GetMapper()->SetScalarVisibility(0); + + anActor->GetProperty()->SetColor(myColor.red() / 255.0, + myColor.green() / 255.0, + myColor.blue() / 255.0); + } } + TSuperClass::UpdateActor(theActor); } //---------------------------------------------------------------------------- diff --git a/src/VISU_I/VISU_ScalarMap_i.cc b/src/VISU_I/VISU_ScalarMap_i.cc index 3677b0d0..c4a51a50 100644 --- a/src/VISU_I/VISU_ScalarMap_i.cc +++ b/src/VISU_I/VISU_ScalarMap_i.cc @@ -335,7 +335,6 @@ void VISU::ScalarMap_i ::UpdateActor(VISU_Actor* theActor) { - TSuperClass::UpdateActor(theActor); if(VISU_ScalarMapAct* anActor = dynamic_cast(theActor)){ VISU_ScalarBarActor *aScalarBar = anActor->GetScalarBar(); aScalarBar->SetLookupTable(myScalarMapPL->GetBarTable()); @@ -363,4 +362,5 @@ VISU::ScalarMap_i aScalarBar->Modified(); } + TSuperClass::UpdateActor(theActor); }