Browse Source

added #ifdef for compiling without opengl and glut

Johannes Ruehle 11 years ago
parent
commit
fcd9a1e946

+ 7 - 2
core/imagedisplay/ArrayPlot.cpp

@@ -10,6 +10,7 @@
 //
 //
 
+#include "core/basics/Exception.h"
 #include "ArrayPlot.h"
 #include <iostream>
 #include <core/basics/numerictools.h>
@@ -53,12 +54,13 @@ ArrayPlot::~ArrayPlot() {
 }
 
 void ArrayPlot::paintGL ( void ) {
+#ifdef NICE_USELIB_OPENGL
   glViewport ( 0, 0, width(), height() );
   glMatrixMode ( GL_PROJECTION );
   glLoadIdentity();
-#ifdef NICE_USELIB_GLUT
+#   ifdef NICE_USELIB_GLUT
   gluOrtho2D ( 0.0, ( GLdouble ) width(), 0.0, ( GLdouble ) height() );
-#endif
+#   endif
 
   double quadWidth = width() / ( double ) ( m_width );
   double quadHeight = height() / ( double ) ( m_height );
@@ -95,6 +97,9 @@ void ArrayPlot::paintGL ( void ) {
 
   glFlush();
 
+#else
+  fthrow(Exception,"OpenGL lib not availabe, recompile using OpenGL!");
+#endif
 };
 
 void ArrayPlot::mousePressEvent ( QMouseEvent* event )

+ 11 - 2
core/imagedisplay/EpipolarGeometryDisplay.cpp

@@ -127,16 +127,22 @@ void EpipolarGeometryDisplay::mousePressEvent ( QMouseEvent* event )
 }
 
 void EpipolarGeometryDisplay::setGLProjection ( void ) {
+#ifdef NICE_USELIB_OPENGL
   glViewport ( 0, 0, width(), height() );
   glMatrixMode ( GL_PROJECTION );
   glLoadIdentity();
-#ifdef NICE_USELIB_GLUT
+#   ifdef NICE_USELIB_GLUT
   gluOrtho2D ( 0.0, ( GLdouble ) width(), 0.0, ( GLdouble ) height() );
+#   else
+  fthrow(Exception,"GLUT lib not availabe, recompile using GLUT!");
+#   endif
+#else
+  fthrow(Exception,"OpenGL lib not availabe, recompile using OpenGL!");
 #endif
 }
 
 void EpipolarGeometryDisplay::paintGLObjects ( void ) {
-
+#ifdef NICE_USELIB_OPENGL
   if ( m_points->size() > 0 ) {
     glPointSize ( 3 );
     glBegin ( GL_POINTS );
@@ -168,6 +174,9 @@ void EpipolarGeometryDisplay::paintGLObjects ( void ) {
     }
     glFlush();
   }
+#else
+  fthrow(Exception,"OpenGL lib not availabe, recompile using OpenGL!");
+#endif
 }
 
 void EpipolarGeometryDisplay::contextMenuEvent ( QContextMenuEvent* event ) {

+ 3 - 3
core/imagedisplay/ImageDisplay.cpp

@@ -223,6 +223,7 @@ void ImageDisplay::repaint() {
 }
 
 void ImageDisplay::paintGL() {
+#ifdef NICE_USELIB_GLUT
   setGLProjection();
   if ( image != NULL ) {
     glPixelStorei ( GL_PACK_ALIGNMENT, 1 );
@@ -284,7 +285,6 @@ void ImageDisplay::paintGL() {
   }
 
   if ( texts.size() > 0 ) {
-#ifdef NICE_USELIB_GLUT
 	  glEnable ( GL_BLEND );
     glBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
 
@@ -307,10 +307,10 @@ void ImageDisplay::paintGL() {
 
     glDisable ( GL_BLEND );
     glFlush();
+  }
 #else
-	 fthrow(Exception,"GLUT lib not availabe, recompile using GLUT!");
+     fthrow(Exception,"GLUT lib not availabe, recompile using GLUT!");
 #endif
-  }
 
   paintGLObjects();
 }

+ 4 - 0
core/imagedisplay/PolygonDrawer.cpp

@@ -26,6 +26,7 @@ PolygonDrawer::~PolygonDrawer() {
 }
 
 void PolygonDrawer::paintGLObjects(void) {
+#ifdef NICE_USELIB_OPENGL
 	if (m_points.size() > 0) {
 		glPointSize(5);
 		glBegin(GL_POINTS);
@@ -51,6 +52,9 @@ void PolygonDrawer::paintGLObjects(void) {
 		glEnd();
 		glFlush();
 	}
+#else
+  fthrow(Exception,"OpenGL lib not availabe, recompile using OpenGL!");
+#endif
 };
 
 void PolygonDrawer::mousePressEvent(QMouseEvent* event) {

+ 4 - 1
core/imagedisplay/SimpleSelector.cpp

@@ -71,6 +71,7 @@ void SimpleSelector::setCurrentColor ( int color )
 
 void SimpleSelector::paintGLObjects(void)
 {
+#ifdef NICE_USELIB_OPENGL
     int index = 0;
     for ( vector<RectT<double> >::const_iterator i = m_rectangles.begin();
 	    i != m_rectangles.end(); i++,index++ )
@@ -111,7 +112,9 @@ void SimpleSelector::paintGLObjects(void)
 			glFlush();
 		}
     }
-
+#else
+  fthrow(Exception,"OpenGL lib not availabe, recompile using OpenGL!");
+#endif
 }
 
 SimpleSelector::~SimpleSelector ()