]> Creatis software - cpPlugins.git/commitdiff
The beast is alive on MSWin!!!
authorLeonardo Florez Valencia <florez-l@javeriana.edu.co>
Fri, 26 Dec 2014 21:52:56 +0000 (22:52 +0100)
committerLeonardo Florez Valencia <florez-l@javeriana.edu.co>
Fri, 26 Dec 2014 21:52:56 +0000 (22:52 +0100)
COMPILATION
appli/ImageMPR/ImageMPR.cxx
lib/cpPlugins/Extensions/Visualization/OpenGLMeshMapper.hxx

index 96717facead63fdf0becb69175ba03a9d861fa9b..eeb844aa0fb8853d6bc3b53bb334360c70b5c41c 100644 (file)
@@ -6,15 +6,30 @@
 @prerequisites
   1. CMake (>=2.8.12.2)
 
-  3. Visualization Toolkit -VTK- (>=6.1.0)
-    3.1 Required cmake flags:
+  2. Visualization Toolkit -VTK- (>=6.1.0)
+    2.1 Required cmake flags:
       BUILD_SHARED_LIBS:BOOL=ON
 
-  4. Insight Toolkit -ITK- (>=4.6.0)
-    4.1 Required cmake flags:
+  3. Insight Toolkit -ITK- (>=4.6.0)
+    3.1 Required cmake flags:
       BUILD_SHARED_LIBS:BOOL=ON
       Module_ITKVtkGlue:BOOL=ON
 
+  4. WARNING: Notes on compilation on MS-Windows
+     As the time being (circa dec 2014), I've been using MSVC-2013
+     (compiler version 12). As expected, weird behavior is related to
+     this config. Please take into account the following in order to
+     have a successful compilation:
+     4.1 If you want to build the Qt-based code, please be sure that
+         it was compiled with EXACTLY the same compiler you are using.
+     4.2 Since the dll load-unload procedure in MSWin is kind of magic,
+         VTK should be compiled as shared libraries and ITK should be
+         compiled as static libraries. This allows a correct
+         execution of the SmartPointer's thus preventing anoying crashes.
+     4.3 If you found more problems in any MSWin config, please let us know at
+         florez-l@javeriana.edu.co
+  
+
 @cmake_flags
   BUILD_DEMOS:BOOL
     Build example applications? (most of them are command line)
index 1d0570304d3c6a00f7cabebd074188f5e3cc51e8..025b8c841dfb1d31bb89545f1e32d7e892eb9b7d 100644 (file)
@@ -6,6 +6,14 @@
 #include <QFileDialog>
 #include <QMessageBox>
 
+#ifdef _WIN32
+#  define PLUGIN_EXT "dll"
+#  define PLUGIN_REGEX "Plugins file (*.dll);;All files (*)"
+#else
+#  define PLUGIN_EXT "so"
+#  define PLUGIN_REGEX "Plugins file (*.so);;All files (*)"
+#endif // _WIN32
+
 // -------------------------------------------------------------------------
 ImageMPR::ImageMPR( QWidget* parent )
   : QMainWindow( parent ),
@@ -56,10 +64,8 @@ _triggered_actionOpenPlugins( )
   QFileDialog dialog( this );
   dialog.setFileMode( QFileDialog::ExistingFile );
   dialog.setDirectory( "." );
-  dialog.setNameFilter(
-    tr( "Plugins file (*.so);;All files (*)" )
-    );
-  dialog.setDefaultSuffix( tr( "so" ) );
+  dialog.setNameFilter( tr( PLUGIN_REGEX ) );
+  dialog.setDefaultSuffix( tr( PLUGIN_EXT ) );
   if( !( dialog.exec( ) ) )
     return;
   
index f1f04682994a47281340c10c22a287afd3af0009..3ad1bc7a1c2fc21f50e056b41951070571eba44d 100644 (file)
@@ -39,17 +39,6 @@ PFNGLUNMAPBUFFERARBPROC          pglUnmapBuffer = 0;
 
 #endif // _WIN32
 
-#ifdef _WIN32
-
-typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval);
-typedef int (WINAPI * PFNWGLGETSWAPINTERVALEXTPROC) (void);
-PFNWGLSWAPINTERVALEXTPROC pwglSwapIntervalEXT = 0;
-PFNWGLGETSWAPINTERVALEXTPROC pwglGetSwapIntervalEXT = 0;
-#define wglSwapIntervalEXT      pwglSwapIntervalEXT
-#define wglGetSwapIntervalEXT   pwglGetSwapIntervalEXT
-
-#endif // _WIN32
-
 // some definitions for what the polydata has in it
 #define CPPLUGINS_VTK_PDM_NORMALS            0x0001
 #define CPPLUGINS_VTK_PDM_COLORS             0x0002
@@ -563,28 +552,27 @@ _ConfigureOpenGL( )
   if( input == NULL )
     return( false );
 
-#ifdef _WIN32 
-  // get pointers to GL functions
-  glGenBuffers =
-    ( PFNGLGENBUFFERSARBPROC )wglGetProcAddress( "glGenBuffers" );
-  glBindBuffer =
-    ( PFNGLBINDBUFFERARBPROC )wglGetProcAddress( "glBindBuffer" );
-  glBufferData =
-    ( PFNGLBUFFERDATAARBPROC )wglGetProcAddress( "glBufferData" );
-  glBufferSubData =
-    ( PFNGLBUFFERSUBDATAARBPROC )wglGetProcAddress( "glBufferSubData" );
-  glDeleteBuffers =
-    ( PFNGLDELETEBUFFERSARBPROC )wglGetProcAddress( "glDeleteBuffers" );
+#ifdef _WIN32
+  // Get pointers to GL functions
+  glGenBuffers = reinterpret_cast< PFNGLGENBUFFERSARBPROC >
+    ( wglGetProcAddress( "glGenBuffers" ) );
+  glBindBuffer = reinterpret_cast< PFNGLBINDBUFFERARBPROC >
+    ( wglGetProcAddress( "glBindBuffer" ) );
+  glBufferData = reinterpret_cast< PFNGLBUFFERDATAARBPROC >
+    ( wglGetProcAddress( "glBufferData" ) );
+  glBufferSubData = reinterpret_cast< PFNGLBUFFERSUBDATAARBPROC >
+    ( wglGetProcAddress( "glBufferSubData" ) );
+  glDeleteBuffers = reinterpret_cast< PFNGLDELETEBUFFERSARBPROC >
+    ( wglGetProcAddress( "glDeleteBuffers" ) );
   glGetBufferParameteriv =
-    ( PFNGLGETBUFFERPARAMETERIVARBPROC )wglGetProcAddress(
-      "glGetBufferParameteriv"
-      );
-  glMapBuffer =
-    ( PFNGLMAPBUFFERARBPROC )wglGetProcAddress( "glMapBuffer" );
-  glUnmapBuffer =
-    ( PFNGLUNMAPBUFFERARBPROC )wglGetProcAddress( "glUnmapBuffer" );
-
-  // check once again VBO extension
+    reinterpret_cast< PFNGLGETBUFFERPARAMETERIVARBPROC >
+    ( wglGetProcAddress( "glGetBufferParameteriv" ) );
+  glMapBuffer = reinterpret_cast< PFNGLMAPBUFFERARBPROC >
+    ( wglGetProcAddress( "glMapBuffer" ) );
+  glUnmapBuffer = reinterpret_cast< PFNGLUNMAPBUFFERARBPROC >
+    ( wglGetProcAddress( "glUnmapBuffer" ) );
+
+  // Check once again VBO extension
   if(
     glGenBuffers != NULL &&
     glBindBuffer != NULL &&
@@ -598,18 +586,6 @@ _ConfigureOpenGL( )
     this->VBOSupported = true;
   else
     this->VBOSupported = false;
-
-  // check EXT_swap_control is supported
-  /* TODO: really needed?
-     wglSwapIntervalEXT =
-     ( PFNWGLSWAPINTERVALEXTPROC )wglGetProcAddress( "wglSwapIntervalEXT" );
-     wglGetSwapIntervalEXT =
-     ( PFNWGLGETSWAPINTERVALEXTPROC )wglGetProcAddress(
-     "wglGetSwapIntervalEXT"
-     );
-     if( wglSwapIntervalEXT != NULL && wglGetSwapIntervalEXT != NULL )
-     wglSwapIntervalEXT( 0 );
-  */
 #else // _WIN32
   // Check if VBO ( Vertex Buffer Object ) is supported
   std::string str = ( const char* )( glGetString( GL_EXTENSIONS ) );