Browse Source

fixed cmake independence of GLUT

unknown 12 years ago
parent
commit
23aa074fc1

+ 2 - 0
core/imagedisplay/ArrayPlot.cpp

@@ -56,7 +56,9 @@ void ArrayPlot::paintGL ( void ) {
   glViewport ( 0, 0, width(), height() );
   glViewport ( 0, 0, width(), height() );
   glMatrixMode ( GL_PROJECTION );
   glMatrixMode ( GL_PROJECTION );
   glLoadIdentity();
   glLoadIdentity();
+#ifdef NICE_USELIB_GLUT
   gluOrtho2D ( 0.0, ( GLdouble ) width(), 0.0, ( GLdouble ) height() );
   gluOrtho2D ( 0.0, ( GLdouble ) width(), 0.0, ( GLdouble ) height() );
+#endif
 
 
   double quadWidth = width() / ( double ) ( m_width );
   double quadWidth = width() / ( double ) ( m_width );
   double quadHeight = height() / ( double ) ( m_height );
   double quadHeight = height() / ( double ) ( m_height );

+ 2 - 0
core/imagedisplay/EpipolarGeometryDisplay.cpp

@@ -130,7 +130,9 @@ void EpipolarGeometryDisplay::setGLProjection ( void ) {
   glViewport ( 0, 0, width(), height() );
   glViewport ( 0, 0, width(), height() );
   glMatrixMode ( GL_PROJECTION );
   glMatrixMode ( GL_PROJECTION );
   glLoadIdentity();
   glLoadIdentity();
+#ifdef NICE_USELIB_GLUT
   gluOrtho2D ( 0.0, ( GLdouble ) width(), 0.0, ( GLdouble ) height() );
   gluOrtho2D ( 0.0, ( GLdouble ) width(), 0.0, ( GLdouble ) height() );
+#endif
 }
 }
 
 
 void EpipolarGeometryDisplay::paintGLObjects ( void ) {
 void EpipolarGeometryDisplay::paintGLObjects ( void ) {

+ 12 - 2
core/imagedisplay/ImageDisplay.cpp

@@ -6,8 +6,9 @@
 #include "core/imagedisplay/ImageDisplay.h"
 #include "core/imagedisplay/ImageDisplay.h"
 
 
 #include <iostream>
 #include <iostream>
-
+#ifdef NICE_USELIB_GLUT
 #include <GL/glut.h>
 #include <GL/glut.h>
+#endif
 #include <qcursor.h>
 #include <qcursor.h>
 #include <q3filedialog.h>
 #include <q3filedialog.h>
 #include <qapplication.h>
 #include <qapplication.h>
@@ -283,7 +284,8 @@ void ImageDisplay::paintGL() {
   }
   }
 
 
   if ( texts.size() > 0 ) {
   if ( texts.size() > 0 ) {
-    glEnable ( GL_BLEND );
+#ifdef NICE_USELIB_GLUT
+	  glEnable ( GL_BLEND );
     glBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
     glBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
 
 
     for ( uint i = 0; i < texts.size(); ++i ) {
     for ( uint i = 0; i < texts.size(); ++i ) {
@@ -305,16 +307,24 @@ void ImageDisplay::paintGL() {
 
 
     glDisable ( GL_BLEND );
     glDisable ( GL_BLEND );
     glFlush();
     glFlush();
+#else
+	  throw std::exception("GLUT lib not availabe, recompile using GLUT!");
+#endif
   }
   }
 
 
   paintGLObjects();
   paintGLObjects();
 }
 }
 
 
 void ImageDisplay::setGLProjection ( void ) {
 void ImageDisplay::setGLProjection ( void ) {
+#ifdef NICE_USELIB_GLUT  
   glViewport ( 0, 0, width(), height() );
   glViewport ( 0, 0, width(), height() );
   glMatrixMode ( GL_PROJECTION );
   glMatrixMode ( GL_PROJECTION );
   glLoadIdentity();
   glLoadIdentity();
   gluOrtho2D ( 0.0, ( GLdouble ) width(), 0.0, ( GLdouble ) height() );
   gluOrtho2D ( 0.0, ( GLdouble ) width(), 0.0, ( GLdouble ) height() );
+#else
+	  throw std::exception("GLUT lib not availabe, recompile using GLUT!");
+#endif
+
 }
 }
 
 
 void ImageDisplay::paintGLObjects ( void ) {
 void ImageDisplay::paintGLObjects ( void ) {

+ 10 - 1
core/imagedisplay/QtFramework.cpp

@@ -5,7 +5,9 @@
  */
  */
 #include "core/imagedisplay/QtFramework.h"
 #include "core/imagedisplay/QtFramework.h"
 #include "core/imagedisplay/DefaultMainWindow.h"
 #include "core/imagedisplay/DefaultMainWindow.h"
-#include <GL/glut.h>
+#ifdef NICE_USELIB_GLUT
+	#include <GL/glut.h>
+#endif
 
 
 namespace NICE {
 namespace NICE {
 
 
@@ -20,7 +22,11 @@ QtFramework::QtFramework()
   fake_argv[0][1] = '\0';
   fake_argv[0][1] = '\0';
   //application.reset(new QApplication(argc, argv));
   //application.reset(new QApplication(argc, argv));
   application = new QApplication(fake_argc, fake_argv);
   application = new QApplication(fake_argc, fake_argv);
+
+#ifdef NICE_USELIB_GLUT
   glutInit(&fake_argc, fake_argv);
   glutInit(&fake_argc, fake_argv);
+#endif
+
 #ifndef WIN32
 #ifndef WIN32
   std::set_terminate(__gnu_cxx::__verbose_terminate_handler);
   std::set_terminate(__gnu_cxx::__verbose_terminate_handler);
 #endif
 #endif
@@ -29,7 +35,10 @@ QtFramework::QtFramework()
 QtFramework::QtFramework(int& argc, char** argv)
 QtFramework::QtFramework(int& argc, char** argv)
     : application(new QApplication(argc, argv)), mainWindow(NULL) {
     : application(new QApplication(argc, argv)), mainWindow(NULL) {
   fake_argv = NULL;
   fake_argv = NULL;
+#ifdef NICE_USELIB_GLUT
   glutInit(&argc, argv);
   glutInit(&argc, argv);
+#endif
+
 #ifndef WIN32
 #ifndef WIN32
   std::set_terminate(__gnu_cxx::__verbose_terminate_handler);
   std::set_terminate(__gnu_cxx::__verbose_terminate_handler);
 #endif
 #endif

+ 2 - 2
core/imagedisplay/progs/showImage.cpp

@@ -31,13 +31,13 @@ int main ( int argc, char **argv )
   return 0;
   return 0;
 }
 }
 #else
 #else
-#warning "showImage only works with GLUT"
+#pragma message NICE_WARNING("showImage only works with GLUT")
 int main ( void ) {
 int main ( void ) {
   fthrow ( Exception, "Please install the GLUT development files..." );
   fthrow ( Exception, "Please install the GLUT development files..." );
 }
 }
 #endif
 #endif
 #else
 #else
-#warning "showImage only works with Qt"
+#pragma message NICE_WARNING("showImage only works with Qt")
 int main ( void ) {
 int main ( void ) {
   fthrow ( Exception, "Please install the Qt development files..." );
   fthrow ( Exception, "Please install the Qt development files..." );
 }
 }