]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
IPAL20695 Changing values of parameters in â\80\9cGauss Pointsâ\80\9d dialog box doesnâ\80...
authordmv <dmv@opencascade.com>
Mon, 12 Jan 2009 07:01:00 +0000 (07:01 +0000)
committerdmv <dmv@opencascade.com>
Mon, 12 Jan 2009 07:01:00 +0000 (07:01 +0000)
src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx
src/VISUGUI/VisuGUI_GaussPointsDlg.cxx
src/VVTK/VVTK_SizeBox.cxx
src/VVTK/VVTK_SizeBox.h

index 2bf3983218a918b536126ea9d25077d723eed7c9..3b829399fea4001d15fc7b12e94ba5654768ab70 100755 (executable)
@@ -483,12 +483,10 @@ float ViewToDisplay( vtkRenderer* theRenderer )
 //
 void VISU_OpenGLPointSpriteMapper::RenderPiece(vtkRenderer *ren, vtkActor *act)
 {
-  bool isUseThisMapper = !( this->UseOpenGLMapper ||
-                           this->PrimitiveType == VISU_OpenGLPointSpriteMapper::GeomSphere );
+  bool isUseThisMapper = this->PrimitiveType != VISU_OpenGLPointSpriteMapper::GeomSphere;
 
   if( isUseThisMapper )
-    if( !this->InitExtensions() )
-      return;
+    this->InitExtensions();
 
   if( !isUseThisMapper )
   {
@@ -964,8 +962,7 @@ void DrawCellsPoints( vtkPolyData *theInput,
 int VISU_OpenGLPointSpriteMapper::Draw(vtkRenderer *theRenderer, vtkActor *theActor)
 {
 
-  if( this->UseOpenGLMapper ||
-      this->PrimitiveType == VISU_OpenGLPointSpriteMapper::GeomSphere )
+  if( this->PrimitiveType == VISU_OpenGLPointSpriteMapper::GeomSphere )
     return MAPPER_SUPERCLASS::Draw( theRenderer, theActor );
 
   vtkUnsignedCharArray *colors = NULL;
@@ -1041,39 +1038,53 @@ int VISU_OpenGLPointSpriteMapper::Draw(vtkRenderer *theRenderer, vtkActor *theAc
        delete aColorFunctor;
       }
 
-      GLuint aBufferObjectID = 0;
-      vglGenBuffersARB( 1, &aBufferObjectID );
-      vglBindBufferARB( GL_ARRAY_BUFFER_ARB, aBufferObjectID );
-      
-      int anArrayObjectSize = sizeof( TVertex ) * aTotalConnectivitySize;
-      vglBufferDataARB( GL_ARRAY_BUFFER_ARB, anArrayObjectSize, aVertexArr, GL_STATIC_DRAW_ARB );
-      
-      delete [] aVertexArr;
-      
-      vglBindBufferARB( GL_ARRAY_BUFFER_ARB, 0 );
-      vglBindBufferARB( GL_ARRAY_BUFFER_ARB, aBufferObjectID );
-      
-      glColorPointer( 4, GL_FLOAT, sizeof(TVertex), (void*)0 );
-      glVertexPointer( 3, GL_FLOAT, sizeof(TVertex), (void*)(4*sizeof(GLfloat)) );
-      
-      glEnableClientState( GL_VERTEX_ARRAY );
-      glEnableClientState( GL_COLOR_ARRAY );
-      
-      glDrawArrays( GL_POINTS, 0, aTotalConnectivitySize );
-      
-      glDisableClientState( GL_COLOR_ARRAY );
-      glDisableClientState( GL_VERTEX_ARRAY );
-      
-      vglDeleteBuffersARB( 1, &aBufferObjectID );
+      if( this->ExtensionsInitialized ) {
+
+       GLuint aBufferObjectID = 0;
+       vglGenBuffersARB( 1, &aBufferObjectID );
+       vglBindBufferARB( GL_ARRAY_BUFFER_ARB, aBufferObjectID );
+       
+       int anArrayObjectSize = sizeof( TVertex ) * aTotalConnectivitySize;
+       vglBufferDataARB( GL_ARRAY_BUFFER_ARB, anArrayObjectSize, aVertexArr, GL_STATIC_DRAW_ARB );
+       
+       delete [] aVertexArr;
+       
+       vglBindBufferARB( GL_ARRAY_BUFFER_ARB, 0 );
+       vglBindBufferARB( GL_ARRAY_BUFFER_ARB, aBufferObjectID );
+       
+       glColorPointer( 4, GL_FLOAT, sizeof(TVertex), (void*)0 );
+       glVertexPointer( 3, GL_FLOAT, sizeof(TVertex), (void*)(4*sizeof(GLfloat)) );
+       
+       glEnableClientState( GL_VERTEX_ARRAY );
+       glEnableClientState( GL_COLOR_ARRAY );
+       
+       glDrawArrays( GL_POINTS, 0, aTotalConnectivitySize );
+       
+       glDisableClientState( GL_COLOR_ARRAY );
+       glDisableClientState( GL_VERTEX_ARRAY );
+       
+       vglDeleteBuffersARB( 1, &aBufferObjectID );
+      } else { // there are no initialized extensions
+       glColorPointer( 4, GL_FLOAT, sizeof(TVertex), aVertexArr );
+       glVertexPointer( 3, GL_FLOAT, sizeof(TVertex), 
+                        (void*)((GLfloat*)((void*)(aVertexArr)) + 4));
+
+       glEnableClientState( GL_VERTEX_ARRAY );
+       glEnableClientState( GL_COLOR_ARRAY );
+       
+       glDrawArrays( GL_POINTS, 0, aTotalConnectivitySize );
+       
+       glDisableClientState( GL_COLOR_ARRAY );
+       glDisableClientState( GL_VERTEX_ARRAY );
+
+       delete [] aVertexArr;
+      }
     }
 
     input->GetVerts()->GetNumberOfCells() + 
     input->GetLines()->GetNumberOfCells() + 
     input->GetPolys()->GetNumberOfCells() + 
     input->GetStrips()->GetNumberOfCells();
-    
-
-
   }
 
 
index 5088f8860f62183a14d4f3c5819696cb86add4a9..3dceca154f267589be7ff7f9b75d37df6a7b099d 100644 (file)
@@ -875,6 +875,12 @@ void VisuGUI_GaussPointsDlg::initFromPrsObject( VISU::ColoredPrs3d_i* thePrs,
   if( !theInit )
     return;
 
+  char* ext = (char*)glGetString( GL_EXTENSIONS );
+  if( strstr( ext, "GL_ARB_point_sprite" ) == NULL ||
+      strstr( ext, "GL_ARB_shader_objects" ) == NULL ||
+      strstr( ext, "GL_ARB_vertex_buffer_object" ) == NULL )
+      mySizeBox->enableSizeControls(false);
+
   myInputPane->initFromPrsObject( myPrsCopy );
   myTabBox->setCurrentPage( 0 );
 }
index 2de208ce328a0df931b8644bd971dd16cb38eed9..f6259b0bb7ba613df5e864f99e321c60ed84edf7 100644 (file)
@@ -345,3 +345,12 @@ void VVTK_SizeBox::onColorButtonPressed()
   if( aColor.isValid() )
     myColorButton->setPaletteBackgroundColor( aColor );
 }
+
+void VVTK_SizeBox::enableSizeControls( bool enabled )
+{
+  myMagnificationSpinBox->setEnabled( enabled );
+  myMaxSizeSpinBox->setEnabled( enabled );
+  myMinSizeSpinBox->setEnabled( enabled );
+  myIncrementSpinBox->setEnabled( enabled );
+  myGeomSizeSpinBox->setEnabled( enabled );
+}
index 70284dc7d300780690291cf31aeac27117340fba..23099d46fbfd9ef35729be5f086c683175d0345d 100644 (file)
@@ -79,6 +79,8 @@ public:
   QColor                   getColor() const;
   void                     setColor( const QColor& );
 
+  void                     enableSizeControls( bool );
+
 protected slots:
   void                     onToggleResults();
   void                     onToggleGeometry();