Back to index

salome-gui  6.5.0
VTKViewer_PolyDataMapper.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 #include "VTKViewer_PolyDataMapper.h"
00021 #include "VTKViewer_MarkerUtils.h"
00022 
00023 #include <utilities.h>
00024 
00025 #include <QString>
00026 
00027 #include <vtkCellArray.h>
00028 #include <vtkImageData.h>
00029 #include <vtkObjectFactory.h>
00030 #include <vtkPointData.h>
00031 #include <vtkPolyData.h>
00032 #include <vtkProperty.h>
00033 #include <vtkRenderer.h>
00034 #include <vtkSmartPointer.h>
00035 #include <vtkTimerLog.h>
00036 #include <vtkWindow.h>
00037 
00038 #ifndef WNT
00039 # ifndef GLX_GLXEXT_LEGACY
00040 #  define GLX_GLXEXT_LEGACY
00041 # endif
00042 # include <GL/glx.h>
00043 # include <dlfcn.h>
00044 #else
00045 # include <wingdi.h>
00046 #endif
00047 
00048 #ifndef VTK_IMPLEMENT_MESA_CXX
00049 vtkCxxRevisionMacro(VTKViewer_PolyDataMapper, "Revision$");
00050 vtkStandardNewMacro(VTKViewer_PolyDataMapper);
00051 #endif
00052 
00053 // some definitions for what the polydata has in it
00054 #define VTK_PDPSM_COLORS             0x0001
00055 #define VTK_PDPSM_CELL_COLORS        0x0002
00056 #define VTK_PDPSM_POINT_TYPE_FLOAT   0x0004
00057 #define VTK_PDPSM_POINT_TYPE_DOUBLE  0x0008
00058 #define VTK_PDPSM_NORMAL_TYPE_FLOAT  0x0010
00059 #define VTK_PDPSM_NORMAL_TYPE_DOUBLE 0x0020
00060 #define VTK_PDPSM_OPAQUE_COLORS      0x0040
00061 
00062 #ifndef APIENTRY
00063 #define APIENTRY
00064 #endif
00065 #ifndef APIENTRYP
00066 #define APIENTRYP APIENTRY *
00067 #endif
00068 
00069 #ifndef GL_VERTEX_PROGRAM_POINT_SIZE_ARB
00070 #define GL_VERTEX_PROGRAM_POINT_SIZE_ARB  0x8642
00071 #endif
00072 
00073 #ifndef GL_ARB_point_sprite
00074 #define GL_POINT_SPRITE_ARB               0x8861
00075 #define GL_COORD_REPLACE_ARB              0x8862
00076 #endif
00077 
00078 #ifndef GL_ARB_vertex_buffer_object
00079 typedef ptrdiff_t GLsizeiptrARB;
00080 
00081 #define GL_ARRAY_BUFFER_ARB               0x8892
00082 #define GL_STATIC_DRAW_ARB                0x88E4
00083 #endif
00084 
00085 typedef void (APIENTRYP PFNGLBINDBUFFERARBPROC) (GLenum target, GLuint buffer);
00086 typedef void (APIENTRYP PFNGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint *buffers);
00087 typedef void (APIENTRYP PFNGLGENBUFFERSARBPROC) (GLsizei n, GLuint *buffers);
00088 typedef void (APIENTRYP PFNGLBUFFERDATAARBPROC) (GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage);
00089 
00090 static PFNGLGENBUFFERSARBPROC               vglGenBuffersARB              = NULL;
00091 static PFNGLBINDBUFFERARBPROC               vglBindBufferARB              = NULL;
00092 static PFNGLBUFFERDATAARBPROC               vglBufferDataARB              = NULL;
00093 static PFNGLDELETEBUFFERSARBPROC            vglDeleteBuffersARB           = NULL;
00094 
00095 #ifndef WNT
00096 #define GL_GetProcAddress( x )   glXGetProcAddressARB( (const GLubyte*)x )
00097 #else
00098 #define GL_GetProcAddress( x )   wglGetProcAddress( (const LPCSTR)x )
00099 #endif
00100 
00101 bool InitializeBufferExtensions()
00102 {
00103   vglGenBuffersARB = (PFNGLGENBUFFERSARBPROC)GL_GetProcAddress( "glGenBuffersARB" );
00104   if( !vglGenBuffersARB )
00105     return false;
00106 
00107   vglBindBufferARB = (PFNGLBINDBUFFERARBPROC)GL_GetProcAddress( "glBindBufferARB" );
00108   if( !vglBindBufferARB )
00109     return false;
00110 
00111   vglBufferDataARB = (PFNGLBUFFERDATAARBPROC)GL_GetProcAddress( "glBufferDataARB" );
00112   if( !vglBufferDataARB )
00113     return false;
00114 
00115   vglDeleteBuffersARB = (PFNGLDELETEBUFFERSARBPROC)GL_GetProcAddress( "glDeleteBuffersARB" );
00116   if( !vglDeleteBuffersARB )
00117     return false;
00118 
00119   return true;
00120 };
00121 
00122 static bool IsBufferExtensionsInitialized = InitializeBufferExtensions();
00123 
00124 //-----------------------------------------------------------------------------
00125 VTKViewer_PolyDataMapper::VTKViewer_PolyDataMapper()
00126 {
00127   Q_INIT_RESOURCE( VTKViewer );
00128 
00129   this->ExtensionsInitialized     = ES_None;
00130 
00131   this->PointSpriteTexture        = 0;
00132 
00133   this->MarkerEnabled             = false;
00134   this->MarkerType                = VTK::MT_NONE;
00135   this->MarkerScale               = VTK::MS_NONE;
00136   this->MarkerId                  = 0;
00137 }
00138 
00139 //-----------------------------------------------------------------------------
00140 VTKViewer_PolyDataMapper::~VTKViewer_PolyDataMapper()
00141 {
00142   if( PointSpriteTexture > 0 )
00143     glDeleteTextures( 1, &PointSpriteTexture );
00144 }
00145 
00146 //-----------------------------------------------------------------------------
00147 void VTKViewer_PolyDataMapper::SetMarkerEnabled( bool theMarkerEnabled )
00148 {
00149   if( this->MarkerEnabled == theMarkerEnabled )
00150     return;
00151 
00152   this->MarkerEnabled = theMarkerEnabled;
00153   this->Modified();
00154 }
00155 
00156 //-----------------------------------------------------------------------------
00157 void VTKViewer_PolyDataMapper::SetMarkerStd( VTK::MarkerType theMarkerType, VTK::MarkerScale theMarkerScale )
00158 {
00159   if( this->MarkerType == theMarkerType && this->MarkerScale == theMarkerScale )
00160     return;
00161 
00162   this->MarkerType = theMarkerType;
00163   this->MarkerScale = theMarkerScale;
00164 
00165   if( this->MarkerType == VTK::MT_NONE || this->MarkerType == VTK::MT_USER ) {
00166     this->ImageData = NULL;
00167     this->Modified();
00168     return;
00169   }
00170 
00171   int aMarkerType = (int)this->MarkerType;
00172   int aMarkerScale = (int)this->MarkerScale;
00173 
00174   int anId = (int)VTK::MS_70 * aMarkerType + aMarkerScale;
00175 
00176   if( this->StandardTextures.find( anId ) == this->StandardTextures.end() )
00177   {
00178     QString aFileName = QString( ":/textures/texture%1.dat" ).arg( aMarkerType );
00179     VTK::MarkerTexture aMarkerTexture;
00180     if( VTK::LoadTextureData( aFileName, theMarkerScale, aMarkerTexture ) )
00181       this->StandardTextures[ anId ] = VTK::MakeVTKImage( aMarkerTexture );
00182   }
00183 
00184   this->ImageData = this->StandardTextures[ anId ];
00185   this->Modified();
00186 }
00187 
00188 //-----------------------------------------------------------------------------
00189 void VTKViewer_PolyDataMapper::SetMarkerTexture( int theMarkerId, VTK::MarkerTexture theMarkerTexture )
00190 {
00191   if( this->MarkerType == VTK::MT_USER && this->MarkerId == theMarkerId )
00192     return;
00193 
00194   this->MarkerType = VTK::MT_USER;
00195   this->MarkerId = theMarkerId;
00196 
00197   if( this->CustomTextures.find( theMarkerId ) == this->CustomTextures.end() )
00198     this->CustomTextures[ theMarkerId ] = VTK::MakeVTKImage( theMarkerTexture );
00199 
00200   this->ImageData = this->CustomTextures[ theMarkerId ];
00201   this->Modified();
00202 }
00203 
00204 //-----------------------------------------------------------------------------
00205 VTK::MarkerType VTKViewer_PolyDataMapper::GetMarkerType()
00206 {
00207   return this->MarkerType;
00208 }
00209 
00210 //-----------------------------------------------------------------------------
00211 VTK::MarkerScale VTKViewer_PolyDataMapper::GetMarkerScale()
00212 {
00213   return this->MarkerScale;
00214 }
00215 
00216 //-----------------------------------------------------------------------------
00217 int VTKViewer_PolyDataMapper::GetMarkerTexture()
00218 {
00219   return this->MarkerId;
00220 }
00221 
00222 //-----------------------------------------------------------------------------
00223 int VTKViewer_PolyDataMapper::InitExtensions()
00224 {
00225   char* ext = (char*)glGetString( GL_EXTENSIONS );
00226   if( !IsBufferExtensionsInitialized ||
00227       strstr( ext, "GL_ARB_point_sprite" ) == NULL ||
00228       strstr( ext, "GL_ARB_vertex_buffer_object" ) == NULL )
00229   {
00230     MESSAGE("Initializing ARB extensions failed");
00231     return ES_Error;
00232   }
00233 
00234   return ES_Ok;
00235 }
00236 
00237 //-----------------------------------------------------------------------------
00238 void VTKViewer_PolyDataMapper::InitPointSprites()
00239 {
00240   glEnable( GL_POINT_SPRITE_ARB );
00241   glEnable( GL_VERTEX_PROGRAM_POINT_SIZE_ARB );
00242 
00243   glPushAttrib( GL_COLOR_BUFFER_BIT | GL_CURRENT_BIT | GL_DEPTH_BUFFER_BIT | GL_ENABLE_BIT | GL_LIGHTING_BIT );
00244 
00245   glDepthFunc( GL_LEQUAL );
00246   glEnable( GL_DEPTH_TEST );
00247 
00248   glEnable( GL_ALPHA_TEST );
00249   glAlphaFunc( GL_GREATER, 0.0 );
00250 
00251   glDisable( GL_LIGHTING );
00252 
00253   glDisable( GL_COLOR_MATERIAL );
00254 }
00255 
00256 //-----------------------------------------------------------------------------
00257 void VTKViewer_PolyDataMapper::CleanupPointSprites()
00258 {
00259   glPopAttrib();
00260 
00261   glDisable( GL_VERTEX_PROGRAM_POINT_SIZE_ARB );
00262   glDisable( GL_POINT_SPRITE_ARB );
00263 }
00264 
00265 //-----------------------------------------------------------------------------
00266 void VTKViewer_PolyDataMapper::InitTextures()
00267 {
00268   if( !this->ImageData.GetPointer() )
00269     return;
00270 
00271   glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
00272   glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
00273   glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
00274   glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
00275 
00276   int* aSize = this->ImageData->GetDimensions();
00277   unsigned char* dataPtr = (unsigned char*)this->ImageData->GetScalarPointer();
00278   glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, aSize[0], aSize[1], 0,
00279                 GL_RGBA, GL_UNSIGNED_BYTE, dataPtr );
00280 
00281   //glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
00282   glEnable( GL_TEXTURE_2D );
00283   glTexEnvf( GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_TRUE );
00284   glBindTexture( GL_TEXTURE_2D, this->PointSpriteTexture );
00285 }
00286 
00287 //-----------------------------------------------------------------------------
00288 void VTKViewer_PolyDataMapper::RenderPiece( vtkRenderer* ren, vtkActor* act )
00289 {
00290   bool isUsePointSprites = this->MarkerEnabled && this->MarkerType != VTK::MT_NONE;
00291   if( isUsePointSprites )
00292   {
00293     if( this->ExtensionsInitialized == ES_None )
00294       this->ExtensionsInitialized = this->InitExtensions();
00295     this->InitPointSprites();
00296     this->InitTextures();
00297   }
00298 
00299   MAPPER_SUPERCLASS::RenderPiece( ren, act );
00300 
00301   if( isUsePointSprites )
00302     this->CleanupPointSprites();
00303 }
00304 
00305 //-----------------------------------------------------------------------------
00306 // Definition of structures and fuctions used in Draw() method
00307 namespace VTK
00308 {
00309   //-----------------------------------------------------------------------------
00310   struct TVertex
00311   {
00312     GLfloat r, g, b, a;
00313     GLfloat vx, vy, vz;
00314   };
00315 
00316   //-----------------------------------------------------------------------------
00317   struct TColorFunctorBase
00318   {
00319     vtkFloatingPointType myAlpha;
00320 
00321     TColorFunctorBase( vtkProperty* theProperty )
00322     {
00323       myAlpha = theProperty->GetOpacity();
00324     }
00325 
00326     virtual
00327     void
00328     get( TVertex& theVertex, vtkIdType thePointId, vtkIdType theCellId ) = 0;
00329   };
00330 
00331   //-----------------------------------------------------------------------------
00332   struct TPropertyColor : TColorFunctorBase
00333   {
00334     vtkFloatingPointType myColor[3];
00335 
00336     TPropertyColor( vtkProperty* theProperty ):
00337       TColorFunctorBase( theProperty )
00338     {
00339       theProperty->GetColor( myColor );
00340     }
00341 
00342     virtual
00343     void
00344     get( TVertex& theVertex, vtkIdType thePointId, vtkIdType theCellId )
00345     {
00346       theVertex.r = myColor[0];
00347       theVertex.g = myColor[1];
00348       theVertex.b = myColor[2];
00349       theVertex.a = myAlpha;
00350     }
00351   };
00352 
00353   //-----------------------------------------------------------------------------
00354   struct TColors2Color : TColorFunctorBase
00355   {
00356     vtkUnsignedCharArray* myColors;
00357 
00358     TColors2Color( vtkProperty* theProperty,
00359                    vtkUnsignedCharArray* theColors ):
00360       TColorFunctorBase( theProperty ),
00361       myColors( theColors )
00362     {}
00363 
00364     virtual
00365     void
00366     get( TVertex& theVertex, vtkIdType thePointId, vtkIdType theCellId )
00367     {
00368       vtkIdType aTupleId = GetTupleId( thePointId, theCellId );
00369       unsigned char* aColor = myColors->GetPointer( aTupleId << 2 );
00370 
00371       theVertex.r = int( aColor[0] ) / 255.0;
00372       theVertex.g = int( aColor[1] ) / 255.0;
00373       theVertex.b = int( aColor[2] ) / 255.0;
00374       theVertex.a = myAlpha;
00375     }
00376 
00377     virtual
00378     vtkIdType
00379     GetTupleId( vtkIdType thePointId, vtkIdType theCellId ) = 0;
00380   };
00381 
00382   //-----------------------------------------------------------------------------
00383   struct TPointColors2Color : TColors2Color
00384   {
00385     TPointColors2Color( vtkProperty* theProperty,
00386                         vtkUnsignedCharArray* theColors ):
00387       TColors2Color( theProperty, theColors )
00388     {}
00389 
00390     virtual
00391     vtkIdType
00392     GetTupleId( vtkIdType thePointId, vtkIdType theCellId )
00393     {
00394       return thePointId;
00395     }
00396   };
00397 
00398   //-----------------------------------------------------------------------------
00399   struct TCellColors2Color : TColors2Color
00400   {
00401     TCellColors2Color( vtkProperty* theProperty,
00402                        vtkUnsignedCharArray* theColors ):
00403       TColors2Color( theProperty, theColors )
00404     {}
00405 
00406     virtual
00407     vtkIdType
00408     GetTupleId( vtkIdType thePointId, vtkIdType theCellId )
00409     {
00410       return theCellId;
00411     }
00412   };
00413 
00414   //-----------------------------------------------------------------------------
00415   template < class TCoordinates >
00416   void DrawPoints( TCoordinates* theStartPoints,
00417                    vtkCellArray* theCells,
00418                    TColorFunctorBase* theColorFunctor,
00419                    TVertex* theVertexArr,
00420                    vtkIdType &theCellId,
00421                    vtkIdType &theVertexId )
00422   {
00423     vtkIdType* ptIds = theCells->GetPointer();
00424     vtkIdType* endPtIds = ptIds + theCells->GetNumberOfConnectivityEntries();
00425 
00426     while ( ptIds < endPtIds ) {
00427       vtkIdType nPts = *ptIds;
00428       ++ptIds;
00429 
00430       while ( nPts > 0 ) {
00431         TVertex& aVertex = theVertexArr[ theVertexId ];
00432         vtkIdType aPointId = *ptIds;
00433 
00434         TCoordinates* anOffsetPoints = theStartPoints + 3 * aPointId;
00435         aVertex.vx = anOffsetPoints[0];
00436         aVertex.vy = anOffsetPoints[1];
00437         aVertex.vz = anOffsetPoints[2];
00438 
00439         theColorFunctor->get( aVertex, aPointId, theCellId );
00440 
00441         ++theVertexId;
00442         ++ptIds; 
00443         --nPts; 
00444       }
00445 
00446       ++theCellId;
00447     }
00448   }
00449 
00450   //-----------------------------------------------------------------------------
00451   template < class TCoordinates >
00452   void DrawCellsPoints( vtkPolyData* theInput,
00453                         vtkPoints* thePoints,
00454                         TColorFunctorBase* theColorFunctor,
00455                         TVertex* theVertexArr )
00456   {
00457     vtkIdType aCellId = 0, aVertexId = 0;
00458 
00459     TCoordinates* aStartPoints = (TCoordinates*)thePoints->GetVoidPointer(0);
00460 
00461     if ( vtkCellArray* aCellArray = theInput->GetVerts() )
00462       DrawPoints( aStartPoints, aCellArray, theColorFunctor, theVertexArr, aCellId, aVertexId );
00463   
00464     if ( vtkCellArray* aCellArray = theInput->GetLines() )
00465       DrawPoints( aStartPoints, aCellArray, theColorFunctor, theVertexArr, aCellId, aVertexId );
00466   
00467     if ( vtkCellArray* aCellArray = theInput->GetPolys() )
00468       DrawPoints( aStartPoints, aCellArray, theColorFunctor, theVertexArr, aCellId, aVertexId );
00469   
00470     if ( vtkCellArray* aCellArray = theInput->GetStrips() )
00471       DrawPoints( aStartPoints, aCellArray, theColorFunctor, theVertexArr, aCellId, aVertexId ); 
00472   }
00473 } // namespace VTK
00474 
00475 //-----------------------------------------------------------------------------
00476 int VTKViewer_PolyDataMapper::Draw( vtkRenderer* ren, vtkActor* act )
00477 {
00478   if( !this->MarkerEnabled || this->MarkerType == VTK::MT_NONE || !this->ImageData.GetPointer() )
00479     return MAPPER_SUPERCLASS::Draw( ren, act );
00480 
00481   vtkUnsignedCharArray* colors = NULL;
00482   vtkPolyData* input  = this->GetInput();
00483   vtkPoints* points;
00484   int noAbort = 1;
00485   int cellScalars = 0;
00486   vtkProperty* prop = act->GetProperty();
00487 
00488   points = input->GetPoints();
00489 
00490   if ( this->Colors )
00491   {
00492     colors = this->Colors;
00493     if ( (this->ScalarMode == VTK_SCALAR_MODE_USE_CELL_DATA ||
00494           this->ScalarMode == VTK_SCALAR_MODE_USE_CELL_FIELD_DATA ||
00495           !input->GetPointData()->GetScalars() )
00496          && this->ScalarMode != VTK_SCALAR_MODE_USE_POINT_FIELD_DATA)
00497       cellScalars = 1;
00498   }
00499 
00500   {
00501     vtkIdType aTotalConnectivitySize = 0;
00502 
00503     if ( vtkCellArray* aCellArray = input->GetVerts() )
00504       aTotalConnectivitySize += aCellArray->GetNumberOfConnectivityEntries() - aCellArray->GetNumberOfCells();
00505 
00506     if ( vtkCellArray* aCellArray = input->GetLines() )
00507       aTotalConnectivitySize += aCellArray->GetNumberOfConnectivityEntries() - aCellArray->GetNumberOfCells();
00508 
00509     if ( vtkCellArray* aCellArray = input->GetPolys() )
00510       aTotalConnectivitySize += aCellArray->GetNumberOfConnectivityEntries() - aCellArray->GetNumberOfCells();
00511 
00512     if ( vtkCellArray* aCellArray = input->GetStrips() )
00513       aTotalConnectivitySize += aCellArray->GetNumberOfConnectivityEntries() - aCellArray->GetNumberOfCells();
00514 
00515     if ( aTotalConnectivitySize > 0 ) {
00516       VTK::TVertex* aVertexArr = new VTK::TVertex[ aTotalConnectivitySize ];
00517 
00518       int* aSize = this->ImageData->GetDimensions();
00519       glPointSize( std::max( aSize[0], aSize[1] ) );
00520 
00521       int aMode = 0; // to remove
00522       {
00523         VTK::TColorFunctorBase* aColorFunctor = NULL;
00524         if( colors && aMode != 1 ) {
00525           if ( cellScalars )
00526             aColorFunctor = new VTK::TCellColors2Color( prop, colors );
00527           else
00528             aColorFunctor = new VTK::TPointColors2Color( prop, colors );
00529         } else {
00530           aColorFunctor = new VTK::TPropertyColor( prop );
00531         }
00532         if ( points->GetDataType() == VTK_FLOAT )
00533           VTK::DrawCellsPoints< float >( input, points, aColorFunctor, aVertexArr );
00534         else
00535           VTK::DrawCellsPoints< double >( input, points, aColorFunctor, aVertexArr );
00536 
00537         delete aColorFunctor;
00538       }
00539 
00540       if( this->ExtensionsInitialized == ES_Ok ) {
00541         GLuint aBufferObjectID = 0;
00542         vglGenBuffersARB( 1, &aBufferObjectID );
00543         vglBindBufferARB( GL_ARRAY_BUFFER_ARB, aBufferObjectID );
00544         
00545         int anArrayObjectSize = sizeof( VTK::TVertex ) * aTotalConnectivitySize;
00546         vglBufferDataARB( GL_ARRAY_BUFFER_ARB, anArrayObjectSize, aVertexArr, GL_STATIC_DRAW_ARB );
00547         
00548         delete [] aVertexArr;
00549         
00550         vglBindBufferARB( GL_ARRAY_BUFFER_ARB, 0 );
00551         vglBindBufferARB( GL_ARRAY_BUFFER_ARB, aBufferObjectID );
00552         
00553         glColorPointer( 4, GL_FLOAT, sizeof(VTK::TVertex), (void*)0 );
00554         glVertexPointer( 3, GL_FLOAT, sizeof(VTK::TVertex), (void*)(4*sizeof(GLfloat)) );
00555         
00556         glEnableClientState( GL_VERTEX_ARRAY );
00557         glEnableClientState( GL_COLOR_ARRAY );
00558         
00559         glDrawArrays( GL_POINTS, 0, aTotalConnectivitySize );
00560         
00561         glDisableClientState( GL_COLOR_ARRAY );
00562         glDisableClientState( GL_VERTEX_ARRAY );
00563         
00564         vglDeleteBuffersARB( 1, &aBufferObjectID );
00565       } else { // there are no extensions
00566         glColorPointer( 4, GL_FLOAT, sizeof(VTK::TVertex), aVertexArr );
00567         glVertexPointer( 3, GL_FLOAT, sizeof(VTK::TVertex), 
00568                          (void*)((GLfloat*)((void*)(aVertexArr)) + 4));
00569 
00570         glEnableClientState( GL_VERTEX_ARRAY );
00571         glEnableClientState( GL_COLOR_ARRAY );
00572         
00573         glDrawArrays( GL_POINTS, 0, aTotalConnectivitySize );
00574         
00575         glDisableClientState( GL_COLOR_ARRAY );
00576         glDisableClientState( GL_VERTEX_ARRAY );
00577 
00578         delete [] aVertexArr;
00579       }
00580     }
00581   }
00582 
00583   this->UpdateProgress(1.0);
00584   return noAbort;
00585 }