]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Fixed Bug GVIEW10165 : Scalar bars are not removed from Viewers after switching from...
authorouv <ouv@opencascade.com>
Thu, 6 Oct 2005 12:02:24 +0000 (12:02 +0000)
committerouv <ouv@opencascade.com>
Thu, 6 Oct 2005 12:02:24 +0000 (12:02 +0000)
src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx
src/VISU_I/VISU_GaussPoints_i.cc
src/VISU_I/VISU_ScalarMap_i.cc

index 94739f9a4476bbfd6b4fd99b588a5b4c23587dd8..8ab150a47b1894474eb38adafe466066bcf5b926 100755 (executable)
@@ -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 )
index 12bb52e7276eee13c9d55f61a7d56c5783cd9576..3aca4537f7e27baeaedd371b002405d33950eb88 100644 (file)
@@ -538,81 +538,82 @@ void
 VISU::GaussPoints_i
 ::UpdateActor(VISU_Actor* theActor) 
 {
-  TSuperClass::UpdateActor(theActor);
   if(VISU_GaussPtsAct* anActor = dynamic_cast<VISU_GaussPtsAct*>(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);
 }
 
 //----------------------------------------------------------------------------
index 3677b0d0a4772817e322eef9610b5cbf5df083a9..c4a51a50e1388bd1561c41f72bc4438b7b6feaf7 100644 (file)
@@ -335,7 +335,6 @@ void
 VISU::ScalarMap_i
 ::UpdateActor(VISU_Actor* theActor) 
 {
-  TSuperClass::UpdateActor(theActor);
   if(VISU_ScalarMapAct* anActor = dynamic_cast<VISU_ScalarMapAct*>(theActor)){
     VISU_ScalarBarActor *aScalarBar = anActor->GetScalarBar();
     aScalarBar->SetLookupTable(myScalarMapPL->GetBarTable());
@@ -363,4 +362,5 @@ VISU::ScalarMap_i
 
     aScalarBar->Modified();
   }
+  TSuperClass::UpdateActor(theActor);
 }