Salome HOME
updated copyright message
[modules/gui.git] / src / VTKViewer / VTKViewer_PolyDataMapper.cxx
index 1e91624cb1971b085e77232e80c9966399fc6f92..d98944141878f194bd83d22005a662f631d8b13b 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2019  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2023  CEA, EDF, OPEN CASCADE
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 #include <vtkRenderWindow.h>
 #include <vtkCommand.h>
 #include <vtkCellData.h>
+#include <vtkUnsignedCharArray.h>
+#include <vtkIdTypeArray.h>
+
+#include <Basics_Utils.hxx>
 
 #ifndef WIN32
 # ifndef GLX_GLXEXT_LEGACY
@@ -73,7 +77,7 @@ void * glXGetProcAddressARB (const GLubyte *name)
 #endif
 
 #ifndef VTK_IMPLEMENT_MESA_CXX
-vtkStandardNewMacro(VTKViewer_PolyDataMapper);
+vtkStandardNewMacro(VTKViewer_PolyDataMapper)
 #endif
 
 // some definitions for what the polydata has in it
@@ -99,13 +103,13 @@ typedef GLfloat TBall;
 
 
 
-void MessageCallback( GLenum source,
+void MessageCallback( GLenum /*source*/,
                       GLenum type,
-                      GLuint id,
+                      GLuint /*id*/,
                       GLenum severity,
-                      GLsizei length,
+                      GLsizei /*length*/,
                       const GLcharARB* message,
-                      const void* userParam )
+                      const void* /*userParam*/ )
 {
   fprintf( stderr, "GL CALLBACK: %s type = 0x%x, severity = 0x%x, message = %s\n",
            ( type == GL_DEBUG_TYPE_ERROR ? "** GL ERROR **" : "" ),
@@ -157,7 +161,12 @@ VTKViewer_PolyDataMapper::~VTKViewer_PolyDataMapper()
 int VTKViewer_PolyDataMapper::InitShader()
 {
 #ifdef VTK_OPENGL2
+#if defined(WIN32) && defined(UNICODE)
+       std::wstring wFilePath = std::wstring(_wgetenv(L"GUI_ROOT_DIR")) + L"/share/salome/resources/gui/Point";
+       std::string filePath = Kernel_Utils::utf8_encode_s(wFilePath.c_str());
+#else
   std::string filePath = std::string( getenv( "GUI_ROOT_DIR") ) + "/share/salome/resources/gui/Point";
+#endif
   if( !this->OpenGLHelper.CreateShaderProgram(filePath, this->PointProgram, this->VertexShader, this->FragmentShader) )
     return false;
 
@@ -174,9 +183,14 @@ int VTKViewer_PolyDataMapper::InitShader()
   this->OpenGLHelper.vglUseProgramObjectARB( current_program );
 
   this->OpenGLHelper.vglGenVertexArraysARB(1, &this->VertexArrayObject);
+#else
+#if defined(WIN32) && defined(UNICODE)
+       std::wstring wFilePath = std::wstring(_wgetenv( L"GUI_ROOT_DIR" ) ) + L"/share/salome/resources/gui/Vertex_Program_ARB.txt";
+       std::string fileName = Kernel_Utils::utf8_encode( wFilePath.c_str() );
 #else
   std::string fileName = std::string( getenv( "GUI_ROOT_DIR") ) +
                          "/share/salome/resources/gui/Vertex_Program_ARB.txt";
+#endif
 
   char* shader = GUI_OPENGL::readFromFile( fileName );
 
@@ -653,7 +667,7 @@ namespace VTK
 
     virtual
     void
-    get( TVertex& theVertex, vtkIdType thePointId, vtkIdType theCellId )
+    get( TVertex& theVertex, vtkIdType /*thePointId*/, vtkIdType /*theCellId*/ )
     {
       theVertex.r = myColor[0];
       theVertex.g = myColor[1];
@@ -701,7 +715,7 @@ namespace VTK
 
     virtual
     vtkIdType
-    GetTupleId( vtkIdType thePointId, vtkIdType theCellId )
+    GetTupleId( vtkIdType thePointId, vtkIdType /*theCellId*/ )
     {
       return thePointId;
     }
@@ -717,7 +731,7 @@ namespace VTK
 
     virtual
     vtkIdType
-    GetTupleId( vtkIdType thePointId, vtkIdType theCellId )
+    GetTupleId( vtkIdType /*thePointId*/, vtkIdType theCellId )
     {
       return theCellId;
     }
@@ -735,7 +749,7 @@ namespace VTK
                    vtkDataArray* theDiamArray,
                    double theBallScale )
   {
-    vtkIdType* ptIds = theCells->GetPointer();
+    vtkIdType* ptIds = theCells->GetData()->GetPointer(0);
     vtkIdType* endPtIds = ptIds + theCells->GetNumberOfConnectivityEntries();
 
     bool mapBalls = false; 
@@ -815,7 +829,6 @@ int VTKViewer_PolyDataMapper::Draw( vtkRenderer* ren, vtkActor* act )
 #else
 //-----------------------------------------------------------------------------
 void VTKViewer_PolyDataMapper::RenderPieceDraw( vtkRenderer* ren, vtkActor* act ) {
-  int noAbort = 1;
   if( (!this->MarkerEnabled || this->MarkerType == VTK::MT_NONE || !this->ImageData.GetPointer()) && !this->BallEnabled) {
     MAPPER_SUPERCLASS::RenderPieceDraw( ren, act );
     return;