Salome HOME
Unicode support: correct handling of unicode on GUI level
[modules/gui.git] / src / VTKViewer / VTKViewer_PolyDataMapper.cxx
index 3f08ccfbbd793f83ee677e11f5a5f8d2f74a61a5..aa4861f806508e25910d97ae53273c0c814f9ccb 100644 (file)
 # ifndef GLX_GLXEXT_LEGACY
 #  define GLX_GLXEXT_LEGACY
 # endif
+#ifdef __APPLE__
+#import <mach-o/dyld.h>
+#import <stdlib.h>
+#import <string.h>
+void * glXGetProcAddressARB (const GLubyte *name)
+
+{
+    NSSymbol symbol;
+    char *symbolName;
+    symbolName = (char *)malloc (strlen ((const char *)name) + 2); // 1
+    strcpy(symbolName + 1, (const char *)name); // 2
+    symbolName[0] = '_'; // 3
+    symbol = NULL;
+    if (NSIsSymbolNameDefined (symbolName)) // 4
+        symbol = NSLookupAndBindSymbol (symbolName);
+    free (symbolName); // 5
+    return symbol ? NSAddressOfSymbol (symbol) : NULL; // 6
+}
+#else
 # include <GL/glx.h>
+#endif
 # include <dlfcn.h>
 #else
 # include <wingdi.h>
@@ -136,7 +156,7 @@ int VTKViewer_PolyDataMapper::InitShader()
   std::string fileName = std::string( getenv( "GUI_ROOT_DIR") ) +
                          "/share/salome/resources/gui/Vertex_Program_ARB.txt";
 
-  char* shader = readFromFile( fileName );
+  char* shader = GUI_OPENGL::readFromFile( fileName );
 
   GLhandleARB VertexShader = this->OpenGLHelper.vglCreateShaderObjectARB( GL_VERTEX_SHADER_ARB );
   this->OpenGLHelper.vglShaderSourceARB( VertexShader, 1, (const GLcharARB**)&shader, NULL );
@@ -245,7 +265,7 @@ void VTKViewer_PolyDataMapper::SetBallEnabled( bool theBallEnabled )
       
       QString anAlphaTexture = getenv( "GUI_ROOT_DIR" );
       anAlphaTexture.append( "/share/salome/resources/gui/sprite_alpha.vti" );
-      vtkSmartPointer<vtkImageData> aTextureValue = VTK::MakeTexture( aMainTexture.toLatin1().constData(), anAlphaTexture.toLatin1().constData() );
+      vtkSmartPointer<vtkImageData> aTextureValue = VTK::MakeTexture( aMainTexture.toUtf8().constData(), anAlphaTexture.toUtf8().constData() );
       this->SpecialTextures[BallTextureId] = aTextureValue;
     }
     this->ImageData = this->SpecialTextures[BallTextureId];
@@ -593,6 +613,8 @@ namespace VTK
     virtual
     void
     get( TVertex& theVertex, vtkIdType thePointId, vtkIdType theCellId ) = 0;
+
+    virtual ~TColorFunctorBase() {}
   };
 
   //-----------------------------------------------------------------------------
@@ -840,7 +862,6 @@ void VTKViewer_PolyDataMapper::InternalDraw(vtkRenderer* ren, vtkActor* act ) {
       }
 
       int* aSize = this->ImageData->GetDimensions();
-      //glPointSize( std::max( aSize[0], aSize[1] ) );
 
       int aMode = 0; // to remove
       {
@@ -945,7 +966,7 @@ void VTKViewer_PolyDataMapper::InternalDraw(vtkRenderer* ren, vtkActor* act ) {
 #else
        GLuint aBufferObjectID, aDiamsID = 0;
        GLint attribute_diams = -1;
-
+       glPointSize( std::max( aSize[0], aSize[1] ) );
        this->OpenGLHelper.vglGenBuffersARB( 1, &aBufferObjectID );
        this->OpenGLHelper.vglBindBufferARB( GL_ARRAY_BUFFER_ARB, aBufferObjectID );
 
@@ -974,7 +995,7 @@ void VTKViewer_PolyDataMapper::InternalDraw(vtkRenderer* ren, vtkActor* act ) {
          this->OpenGLHelper.vglBindBufferARB( GL_ARRAY_BUFFER_ARB, 0 );
          this->OpenGLHelper.vglBindBufferARB( GL_ARRAY_BUFFER_ARB, aDiamsID );
 
-         attribute_diams = vglGetAttribLocationARB(this->PointProgram, "diameter");
+         attribute_diams = this->OpenGLHelper.vglGetAttribLocationARB(this->PointProgram, "diameter");
          this->OpenGLHelper.vglEnableVertexAttribArrayARB(attribute_diams);
          this->OpenGLHelper.vglBindBufferARB(GL_ARRAY_BUFFER_ARB, aDiamsID);
          this->OpenGLHelper.vglVertexAttribPointerARB(