]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
IPAL20695 Qt4 porting. Changing values of parameters in â\80\9cGauss Pointsâ\80\9d dialog...
authordmv <dmv@opencascade.com>
Mon, 29 Dec 2008 11:27:22 +0000 (11:27 +0000)
committerdmv <dmv@opencascade.com>
Mon, 29 Dec 2008 11:27:22 +0000 (11:27 +0000)
src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx
src/VISUGUI/VisuGUI_GaussPointsDlg.cxx
src/VVTK/VVTK_SizeBox.cxx
src/VVTK/VVTK_SizeBox.h

index e49c64d237fd24bce684bed0be841c3467abbd93..fd54f6e014905a3bfdc4b6ab4331ed59de36082c 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,52 @@ 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 not 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 e05b0c146a784b23b8b0a1cf7585d12be1c1022d..8c12f0bd295be621b9c5845dc59c11f47b4cf6ac 100644 (file)
@@ -928,6 +928,13 @@ void VisuGUI_GaussPointsDlg::initFromPrsObject( VISU::ColoredPrs3d_i* thePrs,
   mySizeBox->setIncrement( myPrsCopy->GetMagnificationIncrement() );
   mySizeBox->setColor( myPrsCopy->GetQColor() );
 
+  //Disable Size controls if there are no OpenGL extensions
+  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);
+
   if( !theInit )
     return;
 
index 06d7b68df869755cd0c062cfb15cb6278eb36617..7d040131396351c969e42fa9f3c0e52b35978fc4 100644 (file)
@@ -351,6 +351,15 @@ void VVTK_SizeBox::setColor( const QColor& theColor )
   //myColorButton->setPaletteBackgroundColor( theColor );
 }
 
+void VVTK_SizeBox::enableSizeControls( bool enabled )
+{
+  myMagnificationSpinBox->setEnabled( enabled );
+  myMaxSizeSpinBox->setEnabled( enabled );
+  myMinSizeSpinBox->setEnabled( enabled );
+  myIncrementSpinBox->setEnabled( enabled );
+  myGeomSizeSpinBox->setEnabled( enabled );
+}
+
 /*void VVTK_SizeBox::onColorButtonPressed()
 {
   QPalette aPalette( myColorButton->palette() );
index bb1f0737f96d788e0d573493acf655922854732a..296ff51d20002a8380420b5c58c906b0ef7f9ecd 100644 (file)
@@ -80,6 +80,8 @@ public:
   QColor                   getColor() const;
   void                     setColor( const QColor& );
 
+  void                     enableSizeControls( bool enabled );
+
 protected slots:
   void                     onToggleResults();
   void                     onToggleGeometry();